code: def encode(lng, lat, precision=10, bits_per_char=6):
      
      assert _LNG_INTERVAL[0] <= lng <= _LNG_INTERVAL[1]
      assert _LAT_INTERVAL[0] <= lat <= _LAT_INTERVAL[1]
      assert precision > 0
      assert bits_per_char in (2, 4, 6)
  
      bits = precision * bits_per_char
      level = bits >> 1
      dim = 1 << level
  
      x, y = _coord2int(lng, lat, dim)
  
      if CYTHON_AVAILABLE and bits <= MAX_BITS:
          code = xy2hash_cython(x, y, dim)
      else:
          code = _xy2hash(x, y, dim)
  
      return encode_int(code, bits_per_char).rjust(precision, '0')
docs: Encode a lng/lat position as a geohash using a hilbert curve
  
      This function encodes a lng/lat coordinate to a geohash of length `precision`
      on a corresponding a hilbert curve. Each character encodes `bits_per_char` bits
      per character (allowed are 2, 4 and 6 bits [default 6]). Hence, the geohash encodes
      the lng/lat coordinate using `precision` * `bits_per_char` bits. The number of
      bits devided by 2 give the level of the used hilbert curve, e.g. precision=10, bits_per_char=6
      (default values) use 60 bit and a level 30 hilbert curve to map the globe.
  
      Parameters:
          lng: float          Longitude; between -180.0 and 180.0; WGS 84
          lat: float          Latitude; between -90.0 and 90.0; WGS 84
          precision: int      The number of characters in a geohash
          bits_per_char: int  The number of bits per coding character
  
      Returns:
          str: geohash for lng/lat of length `precision`