nodes: 0, module; 1, function_definition; 2, function_name:loose_search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:asset_manager_id; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, expression_statement; 15, if_statement; 16, identifier:query; 17, string; 18, identifier:kwargs; 19, comment:"""
          Asset search API.
  
          Possible kwargs:
             * threshold: int (default = 0)
             * page_no: int (default = 1)
             * page_size: int (default = 100)
             * sort_fields: list (default = [])
             * asset_types: list (default = [])
             * include_public: bool (default = True)
             * include_data_sources: bool (default = True)
          """; 20, call; 21, assignment; 22, assignment; 23, pattern_list; 24, call; 25, block; 26, assignment; 27, attribute; 28, block; 29, else_clause; 30, attribute; 31, argument_list; 32, identifier:url; 33, call; 34, identifier:params; 35, dictionary; 36, identifier:k; 37, identifier:v; 38, attribute; 39, argument_list; 40, if_statement; 41, expression_statement; 42, identifier:response; 43, call; 44, identifier:response; 45, identifier:ok; 46, expression_statement; 47, expression_statement; 48, expression_statement; 49, return_statement; 50, block; 51, attribute; 52, identifier:info; 53, string; 54, identifier:asset_manager_id; 55, attribute; 56, argument_list; 57, pair; 58, identifier:kwargs; 59, identifier:items; 60, boolean_operator; 61, block; 62, assignment; 63, attribute; 64, argument_list; 65, assignment; 66, assignment; 67, call; 68, identifier:assets; 69, expression_statement; 70, expression_statement; 71, identifier:self; 72, identifier:logger; 73, string_content:Asset Search - Asset Manager: %s; 74, string; 75, identifier:format; 76, keyword_argument; 77, keyword_argument; 78, string; 79, identifier:query; 80, not_operator; 81, call; 82, expression_statement; 83, subscript; 84, identifier:v; 85, attribute; 86, identifier:get; 87, identifier:url; 88, keyword_argument; 89, identifier:data; 90, call; 91, identifier:assets; 92, list_comprehension; 93, attribute; 94, argument_list; 95, call; 96, call; 97, string_content:{endpoint}/assets/search/{asset_manager_id}; 98, identifier:asset_manager_id; 99, identifier:asset_manager_id; 100, identifier:endpoint; 101, attribute; 102, string_content:query; 103, call; 104, identifier:isinstance; 105, argument_list; 106, assignment; 107, identifier:params; 108, identifier:k; 109, identifier:self; 110, identifier:session; 111, identifier:params; 112, identifier:params; 113, attribute; 114, argument_list; 115, call; 116, for_in_clause; 117, attribute; 118, identifier:info; 119, string; 120, call; 121, attribute; 122, argument_list; 123, attribute; 124, argument_list; 125, identifier:self; 126, identifier:endpoint; 127, identifier:isinstance; 128, argument_list; 129, identifier:v; 130, identifier:Iterable; 131, identifier:v; 132, call; 133, identifier:response; 134, identifier:json; 135, identifier:json_to_asset; 136, argument_list; 137, identifier:json_asset; 138, call; 139, identifier:self; 140, identifier:logger; 141, string_content:Returned %s Assets.; 142, identifier:len; 143, argument_list; 144, attribute; 145, identifier:error; 146, attribute; 147, identifier:response; 148, identifier:raise_for_status; 149, identifier:v; 150, identifier:str; 151, attribute; 152, generator_expression; 153, identifier:json_asset; 154, attribute; 155, argument_list; 156, identifier:assets; 157, identifier:self; 158, identifier:logger; 159, identifier:response; 160, identifier:text; 161, string; 162, identifier:join; 163, call; 164, for_in_clause; 165, identifier:data; 166, identifier:get; 167, string; 168, list; 169, string_content:,; 170, identifier:str; 171, argument_list; 172, identifier:i; 173, identifier:v; 174, string_content:hits; 175, identifier:i
code: def loose_search(self, asset_manager_id, query='', **kwargs):
          """
          Asset search API.
  
          Possible kwargs:
             * threshold: int (default = 0)
             * page_no: int (default = 1)
             * page_size: int (default = 100)
             * sort_fields: list (default = [])
             * asset_types: list (default = [])
             * include_public: bool (default = True)
             * include_data_sources: bool (default = True)
          """
          self.logger.info('Asset Search - Asset Manager: %s', asset_manager_id)
          url = '{endpoint}/assets/search/{asset_manager_id}'.format(
              asset_manager_id=asset_manager_id,
              endpoint=self.endpoint,
          )
          params = {'query': query}
          for k, v in kwargs.items():
              if not isinstance(v, str) and isinstance(v, Iterable):
                  v = ','.join(str(i) for i in v)
  
              params[k] = v
  
          response = self.session.get(url, params=params)
          if response.ok:
              data = response.json()
              assets = [json_to_asset(json_asset) for json_asset in data.get('hits', [])]
              self.logger.info('Returned %s Assets.', len(assets))
              return assets
          else:
              self.logger.error(response.text)
              response.raise_for_status()