docs: def get_bounding_box(obj, maxdist):
      """
      Return the dilated bounding box of a geometric object.
  
      :param obj:
          an object with method .get_bounding_box, or with an attribute .polygon
          or a list of locations
      :param maxdist: maximum distance in km
      """
      if hasattr(obj, 'get_bounding_box'):
          return obj.get_bounding_box(maxdist)
      elif hasattr(obj, 'polygon'):
          bbox = obj.polygon.get_bbox()
      else:
          if isinstance(obj, list):  # a list of locations
              lons = numpy.array([loc.longitude for loc in obj])
              lats = numpy.array([loc.latitude for loc in obj])
          else:  # assume an array with fields lon, lat
              lons, lats = obj['lon'], obj['lat']
          min_lon, max_lon = lons.min(), lons.max()
          if cross_idl(min_lon, max_lon):
              lons %= 360
          bbox = lons.min(), lats.min(), lons.max(), lats.max()
      a1 = min(maxdist * KM_TO_DEGREES, 90)
      a2 = min(angular_distance(maxdist, bbox[1], bbox[3]), 180)
      return bbox[0] - a2, bbox[1] - a1, bbox[2] + a2, bbox[3] + a1