nodes: 0, module; 1, function_definition; 2, function_name:places_within_radius; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, comment:# Make the query; 18, if_statement; 19, comment:# Assemble the result; 20, expression_statement; 21, for_statement; 22, return_statement; 23, identifier:place; 24, None; 25, identifier:latitude; 26, None; 27, identifier:longitude; 28, None; 29, identifier:radius; 30, integer:0; 31, identifier:kwargs; 32, comment:"""
          Return descriptions of the places stored in the collection that are
          within the circle specified by the given location and radius.
          A list of dicts will be returned.
  
          The center of the circle can be specified by the identifier of another
          place in the collection with the *place* keyword argument.
          Or, it can be specified by using both the *latitude* and *longitude*
          keyword arguments.
  
          By default the *radius* is given in kilometers, but you may also set
          the *unit* keyword argument to ``'m'``, ``'mi'``, or ``'ft'``.
  
          Limit the number of results returned with the *count* keyword argument.
  
          Change the sorted order by setting the *sort* keyword argument to
          ``b'DESC'``.
          """; 33, assignment; 34, assignment; 35, assignment; 36, call; 37, assignment; 38, comparison_operator:place is not None; 39, block; 40, elif_clause; 41, else_clause; 42, assignment; 43, identifier:item; 44, identifier:response; 45, block; 46, identifier:ret; 47, subscript; 48, True; 49, subscript; 50, True; 51, subscript; 52, False; 53, attribute; 54, argument_list; 55, identifier:unit; 56, call; 57, identifier:place; 58, None; 59, expression_statement; 60, boolean_operator; 61, block; 62, block; 63, identifier:ret; 64, list; 65, expression_statement; 66, identifier:kwargs; 67, string; 68, identifier:kwargs; 69, string; 70, identifier:kwargs; 71, string; 72, identifier:kwargs; 73, identifier:setdefault; 74, string; 75, string; 76, attribute; 77, argument_list; 78, assignment; 79, parenthesized_expression; 80, parenthesized_expression; 81, expression_statement; 82, raise_statement; 83, call; 84, string_content:withdist; 85, string_content:withcoord; 86, string_content:withhash; 87, string_content:sort; 88, string_content:ASC; 89, identifier:kwargs; 90, identifier:setdefault; 91, string; 92, string; 93, identifier:response; 94, call; 95, comparison_operator:latitude is not None; 96, comparison_operator:longitude is not None; 97, assignment; 98, call; 99, attribute; 100, argument_list; 101, string_content:unit; 102, string_content:km; 103, attribute; 104, argument_list; 105, identifier:latitude; 106, None; 107, identifier:longitude; 108, None; 109, identifier:response; 110, call; 111, identifier:ValueError; 112, argument_list; 113, identifier:ret; 114, identifier:append; 115, dictionary; 116, attribute; 117, identifier:georadiusbymember; 118, attribute; 119, call; 120, identifier:radius; 121, dictionary_splat; 122, attribute; 123, argument_list; 124, string; 125, pair; 126, pair; 127, pair; 128, pair; 129, pair; 130, identifier:self; 131, identifier:redis; 132, identifier:self; 133, identifier:key; 134, attribute; 135, argument_list; 136, identifier:kwargs; 137, attribute; 138, identifier:georadius; 139, attribute; 140, identifier:longitude; 141, identifier:latitude; 142, identifier:radius; 143, dictionary_splat; 144, string_content:Must specify place, or both latitude and longitude; 145, string; 146, call; 147, string; 148, subscript; 149, string; 150, identifier:unit; 151, string; 152, subscript; 153, string; 154, subscript; 155, identifier:self; 156, identifier:_pickle; 157, identifier:place; 158, identifier:self; 159, identifier:redis; 160, identifier:self; 161, identifier:key; 162, identifier:kwargs; 163, string_content:place; 164, attribute; 165, argument_list; 166, string_content:distance; 167, identifier:item; 168, integer:1; 169, string_content:unit; 170, string_content:latitude; 171, subscript; 172, integer:1; 173, string_content:longitude; 174, subscript; 175, integer:0; 176, identifier:self; 177, identifier:_unpickle; 178, subscript; 179, identifier:item; 180, integer:2; 181, identifier:item; 182, integer:2; 183, identifier:item; 184, integer:0
code: def places_within_radius(
          self, place=None, latitude=None, longitude=None, radius=0, **kwargs
      ):
          """
          Return descriptions of the places stored in the collection that are
          within the circle specified by the given location and radius.
          A list of dicts will be returned.
  
          The center of the circle can be specified by the identifier of another
          place in the collection with the *place* keyword argument.
          Or, it can be specified by using both the *latitude* and *longitude*
          keyword arguments.
  
          By default the *radius* is given in kilometers, but you may also set
          the *unit* keyword argument to ``'m'``, ``'mi'``, or ``'ft'``.
  
          Limit the number of results returned with the *count* keyword argument.
  
          Change the sorted order by setting the *sort* keyword argument to
          ``b'DESC'``.
          """
          kwargs['withdist'] = True
          kwargs['withcoord'] = True
          kwargs['withhash'] = False
          kwargs.setdefault('sort', 'ASC')
          unit = kwargs.setdefault('unit', 'km')
  
          # Make the query
          if place is not None:
              response = self.redis.georadiusbymember(
                  self.key, self._pickle(place), radius, **kwargs
              )
          elif (latitude is not None) and (longitude is not None):
              response = self.redis.georadius(
                  self.key, longitude, latitude, radius, **kwargs
              )
          else:
              raise ValueError(
                  'Must specify place, or both latitude and longitude'
              )
  
          # Assemble the result
          ret = []
          for item in response:
              ret.append(
                  {
                      'place': self._unpickle(item[0]),
                      'distance': item[1],
                      'unit': unit,
                      'latitude': item[2][1],
                      'longitude': item[2][0],
                  }
              )
  
          return ret