nodes: 0, module; 1, function_definition; 2, function_name:list_; 3, parameters; 4, block; 5, default_parameter; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, comment:## update properties; 10, comment:# NOTE: properties should be a list; 11, expression_statement; 12, if_statement; 13, comment:# NOTE: name should be first property; 14, comment:#       we loop here because there 'name' can be in the list; 15, comment:#       multiple times.; 16, while_statement; 17, expression_statement; 18, comment:## Configure command; 19, comment:# NOTE: initialize the defaults; 20, expression_statement; 21, expression_statement; 22, comment:# NOTE: set extra config from kwargs; 23, if_statement; 24, if_statement; 25, if_statement; 26, expression_statement; 27, if_statement; 28, if_statement; 29, comment:## parse zfs list; 30, expression_statement; 31, if_statement; 32, return_statement; 33, identifier:name; 34, None; 35, identifier:kwargs; 36, string:'''
      Return a list of all datasets or a specified dataset on the system and the
      values of their used, available, referenced, and mountpoint properties.
  
      name : string
          name of dataset, volume, or snapshot
      recursive : boolean
          recursively list children
      depth : int
          limit recursion to depth
      properties : string
          comma-separated list of properties to list, the name property will always be added
      type : string
          comma-separated list of types to display, where type is one of
          filesystem, snapshot, volume, bookmark, or all.
      sort : string
          property to sort on (default = name)
      order : string [ascending|descending]
          sort order (default = ascending)
      parsable : boolean
          display numbers in parsable (exact) values
          .. versionadded:: 2018.3.0
  
      .. versionadded:: 2015.5.0
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' zfs.list
          salt '*' zfs.list myzpool/mydataset [recursive=True|False]
          salt '*' zfs.list myzpool/mydataset properties="sharenfs,mountpoint"
  
      '''; 37, assignment; 38, assignment; 39, not_operator; 40, block; 41, comparison_operator:'name' in properties; 42, block; 43, call; 44, assignment; 45, assignment; 46, call; 47, block; 48, boolean_operator; 49, block; 50, call; 51, block; 52, assignment; 53, boolean_operator; 54, block; 55, call; 56, comment:# NOTE: There can be only one -o and it takes a comma-seperated list; 57, block; 58, else_clause; 59, assignment; 60, comparison_operator:res['retcode'] == 0; 61, block; 62, else_clause; 63, identifier:ret; 64, identifier:ret; 65, call; 66, identifier:properties; 67, call; 68, call; 69, expression_statement; 70, string; 71, identifier:properties; 72, expression_statement; 73, attribute; 74, argument_list; 75, identifier:flags; 76, list; 77, identifier:opts; 78, dictionary; 79, attribute; 80, argument_list; 81, expression_statement; 82, call; 83, call; 84, expression_statement; 85, attribute; 86, argument_list; 87, expression_statement; 88, identifier:kwargs_sort; 89, call; 90, identifier:kwargs_sort; 91, comparison_operator:kwargs_sort in properties; 92, if_statement; 93, identifier:isinstance; 94, argument_list; 95, expression_statement; 96, block; 97, identifier:res; 98, call; 99, subscript; 100, integer:0; 101, for_statement; 102, block; 103, identifier:OrderedDict; 104, argument_list; 105, attribute; 106, argument_list; 107, identifier:isinstance; 108, argument_list; 109, assignment; 110, string_content:name; 111, call; 112, identifier:properties; 113, identifier:insert; 114, integer:0; 115, string; 116, string; 117, identifier:kwargs; 118, identifier:get; 119, string; 120, False; 121, call; 122, attribute; 123, argument_list; 124, attribute; 125, argument_list; 126, assignment; 127, identifier:kwargs; 128, identifier:get; 129, string; 130, False; 131, assignment; 132, attribute; 133, argument_list; 134, identifier:kwargs_sort; 135, identifier:properties; 136, call; 137, block; 138, else_clause; 139, identifier:properties; 140, identifier:list; 141, assignment; 142, expression_statement; 143, subscript; 144, argument_list; 145, identifier:res; 146, string; 147, identifier:ds; 148, call; 149, block; 150, return_statement; 151, identifier:kwargs; 152, identifier:get; 153, string; 154, string; 155, identifier:properties; 156, identifier:list; 157, identifier:properties; 158, call; 159, attribute; 160, argument_list; 161, string_content:name; 162, string_content:-H; 163, string_content:recursive; 164, attribute; 165, argument_list; 166, identifier:kwargs; 167, identifier:get; 168, string; 169, False; 170, identifier:kwargs; 171, identifier:get; 172, string; 173, False; 174, subscript; 175, call; 176, string_content:type; 177, subscript; 178, call; 179, identifier:kwargs; 180, identifier:get; 181, string; 182, False; 183, attribute; 184, argument_list; 185, expression_statement; 186, block; 187, subscript; 188, call; 189, assignment; 190, identifier:__salt__; 191, string; 192, call; 193, keyword_argument; 194, string_content:retcode; 195, attribute; 196, argument_list; 197, if_statement; 198, expression_statement; 199, delete_statement; 200, call; 201, string_content:properties; 202, string_content:used,avail,refer,mountpoint; 203, attribute; 204, argument_list; 205, identifier:properties; 206, identifier:remove; 207, string; 208, identifier:flags; 209, identifier:append; 210, string; 211, string_content:recursive; 212, string_content:depth; 213, identifier:opts; 214, string; 215, attribute; 216, argument_list; 217, identifier:opts; 218, string; 219, attribute; 220, argument_list; 221, string_content:sort; 222, call; 223, identifier:startswith; 224, string; 225, assignment; 226, expression_statement; 227, identifier:opts; 228, string; 229, attribute; 230, argument_list; 231, subscript; 232, identifier:properties; 233, string_content:cmd.run_all; 234, subscript; 235, argument_list; 236, identifier:python_shell; 237, False; 238, subscript; 239, identifier:splitlines; 240, call; 241, block; 242, else_clause; 243, assignment; 244, subscript; 245, subscript; 246, argument_list; 247, identifier:properties; 248, identifier:split; 249, string; 250, string_content:name; 251, string_content:-r; 252, string_content:-d; 253, identifier:kwargs; 254, identifier:get; 255, string; 256, string_content:-t; 257, identifier:kwargs; 258, identifier:get; 259, string; 260, attribute; 261, argument_list; 262, string_content:a; 263, subscript; 264, identifier:kwargs_sort; 265, assignment; 266, string_content:-o; 267, string; 268, identifier:join; 269, identifier:properties; 270, identifier:opts; 271, string; 272, identifier:__utils__; 273, string; 274, keyword_argument; 275, keyword_argument; 276, keyword_argument; 277, keyword_argument; 278, identifier:res; 279, string; 280, attribute; 281, argument_list; 282, expression_statement; 283, block; 284, subscript; 285, identifier:ds_data; 286, subscript; 287, string; 288, identifier:__utils__; 289, string; 290, identifier:res; 291, string_content:,; 292, string_content:depth; 293, string_content:type; 294, identifier:kwargs; 295, identifier:get; 296, string; 297, string; 298, identifier:opts; 299, string; 300, subscript; 301, identifier:kwargs_sort; 302, string_content:,; 303, string_content:-o; 304, string_content:zfs.zfs_command; 305, identifier:command; 306, string; 307, identifier:flags; 308, identifier:flags; 309, identifier:opts; 310, identifier:opts; 311, identifier:target; 312, identifier:name; 313, string_content:stdout; 314, identifier:kwargs; 315, identifier:get; 316, string; 317, True; 318, assignment; 319, expression_statement; 320, identifier:ret; 321, subscript; 322, identifier:ret; 323, subscript; 324, string_content:name; 325, string_content:zfs.parse_command_result; 326, string_content:order; 327, string_content:ascending; 328, string_content:-s; 329, identifier:opts; 330, string; 331, string_content:list; 332, string_content:parsable; 333, identifier:ds_data; 334, call; 335, assignment; 336, identifier:ds_data; 337, string; 338, identifier:ds_data; 339, string; 340, string_content:-S; 341, subscript; 342, argument_list; 343, identifier:ds_data; 344, call; 345, string_content:name; 346, string_content:name; 347, identifier:__utils__; 348, string; 349, call; 350, subscript; 351, argument_list; 352, string_content:zfs.from_auto_dict; 353, identifier:OrderedDict; 354, argument_list; 355, identifier:__utils__; 356, string; 357, call; 358, keyword_argument; 359, call; 360, string_content:zfs.to_auto_dict; 361, identifier:OrderedDict; 362, argument_list; 363, identifier:convert_to_human; 364, True; 365, identifier:list; 366, argument_list; 367, call; 368, call; 369, identifier:list; 370, argument_list; 371, identifier:zip; 372, argument_list; 373, call; 374, identifier:properties; 375, call; 376, identifier:zip; 377, argument_list; 378, attribute; 379, argument_list; 380, identifier:properties; 381, call; 382, identifier:ds; 383, identifier:split; 384, string:"\t"; 385, attribute; 386, argument_list; 387, identifier:ds; 388, identifier:split; 389, string:"\t"
code: def list_(name=None, **kwargs):
      '''
      Return a list of all datasets or a specified dataset on the system and the
      values of their used, available, referenced, and mountpoint properties.
  
      name : string
          name of dataset, volume, or snapshot
      recursive : boolean
          recursively list children
      depth : int
          limit recursion to depth
      properties : string
          comma-separated list of properties to list, the name property will always be added
      type : string
          comma-separated list of types to display, where type is one of
          filesystem, snapshot, volume, bookmark, or all.
      sort : string
          property to sort on (default = name)
      order : string [ascending|descending]
          sort order (default = ascending)
      parsable : boolean
          display numbers in parsable (exact) values
          .. versionadded:: 2018.3.0
  
      .. versionadded:: 2015.5.0
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' zfs.list
          salt '*' zfs.list myzpool/mydataset [recursive=True|False]
          salt '*' zfs.list myzpool/mydataset properties="sharenfs,mountpoint"
  
      '''
      ret = OrderedDict()
  
      ## update properties
      # NOTE: properties should be a list
      properties = kwargs.get('properties', 'used,avail,refer,mountpoint')
      if not isinstance(properties, list):
          properties = properties.split(',')
  
      # NOTE: name should be first property
      #       we loop here because there 'name' can be in the list
      #       multiple times.
      while 'name' in properties:
          properties.remove('name')
      properties.insert(0, 'name')
  
      ## Configure command
      # NOTE: initialize the defaults
      flags = ['-H']
      opts = {}
  
      # NOTE: set extra config from kwargs
      if kwargs.get('recursive', False):
          flags.append('-r')
      if kwargs.get('recursive', False) and kwargs.get('depth', False):
          opts['-d'] = kwargs.get('depth')
      if kwargs.get('type', False):
          opts['-t'] = kwargs.get('type')
      kwargs_sort = kwargs.get('sort', False)
      if kwargs_sort and kwargs_sort in properties:
          if kwargs.get('order', 'ascending').startswith('a'):
              opts['-s'] = kwargs_sort
          else:
              opts['-S'] = kwargs_sort
      if isinstance(properties, list):
          # NOTE: There can be only one -o and it takes a comma-seperated list
          opts['-o'] = ','.join(properties)
      else:
          opts['-o'] = properties
  
      ## parse zfs list
      res = __salt__['cmd.run_all'](
          __utils__['zfs.zfs_command'](
              command='list',
              flags=flags,
              opts=opts,
              target=name,
          ),
          python_shell=False,
      )
      if res['retcode'] == 0:
          for ds in res['stdout'].splitlines():
              if kwargs.get('parsable', True):
                  ds_data = __utils__['zfs.from_auto_dict'](
                      OrderedDict(list(zip(properties, ds.split("\t")))),
                  )
              else:
                  ds_data = __utils__['zfs.to_auto_dict'](
                      OrderedDict(list(zip(properties, ds.split("\t")))),
                      convert_to_human=True,
                  )
  
              ret[ds_data['name']] = ds_data
              del ret[ds_data['name']]['name']
      else:
          return __utils__['zfs.parse_command_result'](res)
  
      return ret