nodes: 0, module; 1, function_definition; 2, function_name:get_list; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, if_statement; 16, if_statement; 17, expression_statement; 18, if_statement; 19, expression_statement; 20, expression_statement; 21, for_statement; 22, return_statement; 23, identifier:list_type; 24, None; 25, identifier:search_term; 26, None; 27, identifier:page; 28, None; 29, identifier:page_size; 30, None; 31, identifier:sort_by; 32, None; 33, string; 34, assignment; 35, comparison_operator:list_type is not None; 36, block; 37, comparison_operator:search_term is not None; 38, block; 39, comparison_operator:page is not None; 40, block; 41, comparison_operator:page_size is not None; 42, block; 43, comparison_operator:sort_by is not None; 44, block; 45, assignment; 46, comparison_operator:response_xml is None; 47, block; 48, assignment; 49, assignment; 50, identifier:d; 51, call; 52, block; 53, identifier:domains; 54, string_content:Returns a list of domains for the particular user as a list of objects
      offset by ``page`` length of ``page_size``
  
      list_type : ALL
          One of ``ALL``, ``EXPIRING``, ``EXPIRED``
  
      search_term
          Keyword to look for on the domain list
  
      page : 1
          Number of result page to return
  
      page_size : 20
          Number of domains to be listed per page (minimum: ``10``, maximum:
          ``100``)
  
      sort_by
          One of ``NAME``, ``NAME_DESC``, ``EXPIREDATE``, ``EXPIREDATE_DESC``,
          ``CREATEDATE``, or ``CREATEDATE_DESC``
  
      CLI Example:
  
      .. code-block:: bash
  
          salt 'my-minion' namecheap_domains.get_list; 55, identifier:opts; 56, call; 57, identifier:list_type; 58, None; 59, if_statement; 60, expression_statement; 61, identifier:search_term; 62, None; 63, if_statement; 64, expression_statement; 65, identifier:page; 66, None; 67, expression_statement; 68, identifier:page_size; 69, None; 70, if_statement; 71, expression_statement; 72, identifier:sort_by; 73, None; 74, if_statement; 75, expression_statement; 76, identifier:response_xml; 77, call; 78, identifier:response_xml; 79, None; 80, return_statement; 81, identifier:domainresult; 82, subscript; 83, identifier:domains; 84, list; 85, attribute; 86, argument_list; 87, expression_statement; 88, attribute; 89, argument_list; 90, comparison_operator:list_type not in ['ALL', 'EXPIRING', 'EXPIRED']; 91, block; 92, assignment; 93, comparison_operator:len(search_term) > 70; 94, block; 95, assignment; 96, assignment; 97, boolean_operator; 98, block; 99, assignment; 100, comparison_operator:sort_by not in ['NAME', 'NAME_DESC', 'EXPIREDATE', 'EXPIREDATE_DESC', 'CREATEDATE', 'CREATEDATE_DESC']; 101, block; 102, assignment; 103, attribute; 104, argument_list; 105, list; 106, call; 107, integer:0; 108, identifier:domainresult; 109, identifier:getElementsByTagName; 110, string:"Domain"; 111, call; 112, attribute; 113, identifier:get_opts; 114, string; 115, identifier:list_type; 116, list; 117, expression_statement; 118, raise_statement; 119, subscript; 120, identifier:list_type; 121, call; 122, integer:70; 123, expression_statement; 124, expression_statement; 125, subscript; 126, identifier:search_term; 127, subscript; 128, identifier:page; 129, comparison_operator:page_size > 100; 130, comparison_operator:page_size < 10; 131, expression_statement; 132, raise_statement; 133, subscript; 134, identifier:page_size; 135, identifier:sort_by; 136, list; 137, expression_statement; 138, raise_statement; 139, subscript; 140, identifier:sort_by; 141, attribute; 142, identifier:get_request; 143, identifier:opts; 144, attribute; 145, argument_list; 146, attribute; 147, argument_list; 148, attribute; 149, identifier:namecheap; 150, string_content:namecheap.domains.getList; 151, string; 152, string; 153, string; 154, call; 155, call; 156, identifier:opts; 157, string; 158, identifier:len; 159, argument_list; 160, call; 161, assignment; 162, identifier:opts; 163, string; 164, identifier:opts; 165, string; 166, identifier:page_size; 167, integer:100; 168, identifier:page_size; 169, integer:10; 170, call; 171, call; 172, identifier:opts; 173, string; 174, string; 175, string; 176, string; 177, string; 178, string; 179, string; 180, call; 181, call; 182, identifier:opts; 183, string; 184, attribute; 185, identifier:namecheap; 186, identifier:response_xml; 187, identifier:getElementsByTagName; 188, string:"DomainGetListResult"; 189, identifier:domains; 190, identifier:append; 191, call; 192, identifier:salt; 193, identifier:utils; 194, string_content:ALL; 195, string_content:EXPIRING; 196, string_content:EXPIRED; 197, attribute; 198, argument_list; 199, identifier:Exception; 200, argument_list; 201, string_content:ListType; 202, identifier:search_term; 203, attribute; 204, argument_list; 205, identifier:search_term; 206, subscript; 207, string_content:SearchTerm; 208, string_content:Page; 209, attribute; 210, argument_list; 211, identifier:Exception; 212, argument_list; 213, string_content:PageSize; 214, string_content:NAME; 215, string_content:NAME_DESC; 216, string_content:EXPIREDATE; 217, string_content:EXPIREDATE_DESC; 218, string_content:CREATEDATE; 219, string_content:CREATEDATE_DESC; 220, attribute; 221, argument_list; 222, identifier:Exception; 223, argument_list; 224, string_content:SortBy; 225, identifier:salt; 226, identifier:utils; 227, attribute; 228, argument_list; 229, identifier:log; 230, identifier:error; 231, string; 232, string; 233, identifier:log; 234, identifier:warning; 235, string; 236, identifier:search_term; 237, slice; 238, identifier:log; 239, identifier:error; 240, string; 241, string; 242, identifier:log; 243, identifier:error; 244, string; 245, string; 246, attribute; 247, identifier:atts_to_dict; 248, identifier:d; 249, string_content:Invalid option for list_type; 250, string_content:Invalid option for list_type; 251, string_content:search_term trimmed to first 70 characters; 252, integer:0; 253, integer:70; 254, string_content:Invalid option for page; 255, string_content:Invalid option for page; 256, string_content:Invalid option for sort_by; 257, string_content:Invalid option for sort_by; 258, attribute; 259, identifier:namecheap; 260, identifier:salt; 261, identifier:utils
code: def get_list(list_type=None,
               search_term=None,
               page=None,
               page_size=None,
               sort_by=None):
      '''
      Returns a list of domains for the particular user as a list of objects
      offset by ``page`` length of ``page_size``
  
      list_type : ALL
          One of ``ALL``, ``EXPIRING``, ``EXPIRED``
  
      search_term
          Keyword to look for on the domain list
  
      page : 1
          Number of result page to return
  
      page_size : 20
          Number of domains to be listed per page (minimum: ``10``, maximum:
          ``100``)
  
      sort_by
          One of ``NAME``, ``NAME_DESC``, ``EXPIREDATE``, ``EXPIREDATE_DESC``,
          ``CREATEDATE``, or ``CREATEDATE_DESC``
  
      CLI Example:
  
      .. code-block:: bash
  
          salt 'my-minion' namecheap_domains.get_list
      '''
      opts = salt.utils.namecheap.get_opts('namecheap.domains.getList')
  
      if list_type is not None:
          if list_type not in ['ALL', 'EXPIRING', 'EXPIRED']:
              log.error('Invalid option for list_type')
              raise Exception('Invalid option for list_type')
          opts['ListType'] = list_type
  
      if search_term is not None:
          if len(search_term) > 70:
              log.warning('search_term trimmed to first 70 characters')
              search_term = search_term[0:70]
          opts['SearchTerm'] = search_term
  
      if page is not None:
          opts['Page'] = page
  
      if page_size is not None:
          if page_size > 100 or page_size < 10:
              log.error('Invalid option for page')
              raise Exception('Invalid option for page')
          opts['PageSize'] = page_size
  
      if sort_by is not None:
          if sort_by not in ['NAME', 'NAME_DESC', 'EXPIREDATE', 'EXPIREDATE_DESC', 'CREATEDATE', 'CREATEDATE_DESC']:
              log.error('Invalid option for sort_by')
              raise Exception('Invalid option for sort_by')
          opts['SortBy'] = sort_by
  
      response_xml = salt.utils.namecheap.get_request(opts)
  
      if response_xml is None:
          return []
  
      domainresult = response_xml.getElementsByTagName("DomainGetListResult")[0]
  
      domains = []
      for d in domainresult.getElementsByTagName("Domain"):
          domains.append(salt.utils.namecheap.atts_to_dict(d))
  
      return domains