nodes: 0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, return_statement; 17, identifier:sort_map; 18, dictionary; 19, identifier:strict_sort; 20, False; 21, string; 22, assignment; 23, identifier:strict_sort; 24, block; 25, assignment; 26, assignment; 27, assignment; 28, assignment; 29, identifier:items; 30, pair; 31, pair; 32, pair; 33, pair; 34, pair; 35, string_content:Sends a search request to emby, returns results
  
      |coro|
  
      Parameters
      ----------
      query : str
        the search string to send to emby
      sort_map : dict
        is a dict of strings to ints. Strings should be item types, and
        the ints are the priority of those types(for sorting).
        lower valued(0) will appear first.
      strict_sort : bool
        if True, then only item types in the keys of sortmap will be
        included in the results
  
      Returns
      -------
      list
        list of emby objects; 36, identifier:search_params; 37, dictionary; 38, expression_statement; 39, identifier:json; 40, await; 41, identifier:items; 42, await; 43, identifier:m_size; 44, call; 45, identifier:items; 46, call; 47, string; 48, integer:0; 49, string; 50, integer:1; 51, string; 52, integer:2; 53, string; 54, integer:3; 55, string; 56, integer:4; 57, pair; 58, pair; 59, assignment; 60, call; 61, call; 62, identifier:len; 63, argument_list; 64, identifier:sorted; 65, argument_list; 66, string_content:BoxSet; 67, string_content:Series; 68, string_content:Movie; 69, string_content:Audio; 70, string_content:Person; 71, string; 72, False; 73, string; 74, identifier:query; 75, subscript; 76, call; 77, attribute; 78, argument_list; 79, attribute; 80, argument_list; 81, identifier:sort_map; 82, identifier:items; 83, keyword_argument; 84, string_content:remote; 85, string_content:searchTerm; 86, identifier:search_params; 87, string; 88, attribute; 89, argument_list; 90, attribute; 91, identifier:getJson; 92, string; 93, dictionary_splat; 94, identifier:self; 95, identifier:process; 96, subscript; 97, identifier:key; 98, lambda; 99, string_content:IncludeItemTypes; 100, string; 101, identifier:join; 102, call; 103, identifier:self; 104, identifier:connector; 105, string_content:/Search/Hints/; 106, identifier:search_params; 107, identifier:json; 108, string:"SearchHints"; 109, lambda_parameters; 110, call; 111, string_content:,; 112, attribute; 113, argument_list; 114, identifier:x; 115, attribute; 116, argument_list; 117, identifier:sort_map; 118, identifier:keys; 119, identifier:sort_map; 120, identifier:get; 121, attribute; 122, identifier:m_size; 123, identifier:x; 124, identifier:type
code: async def search(self, query,
              sort_map = {'BoxSet':0,'Series':1,'Movie':2,'Audio':3,'Person':4},
              strict_sort = False):
      '''Sends a search request to emby, returns results
  
      |coro|
  
      Parameters
      ----------
      query : str
        the search string to send to emby
      sort_map : dict
        is a dict of strings to ints. Strings should be item types, and
        the ints are the priority of those types(for sorting).
        lower valued(0) will appear first.
      strict_sort : bool
        if True, then only item types in the keys of sortmap will be
        included in the results
  
      Returns
      -------
      list
        list of emby objects
      '''
      search_params = {
        'remote'     : False,
        'searchTerm' : query
      }
      if strict_sort:
        search_params['IncludeItemTypes'] = ','.join(sort_map.keys())
  
      json  = await self.connector.getJson('/Search/Hints/', **search_params)
      items = await self.process(json["SearchHints"])
  
      m_size = len(sort_map)
      items  = sorted(items, key = lambda x : sort_map.get(x.type, m_size))
  
      return items