old_contents: from skylines.model import Airspace, Location
  
  
  def get_airspaces_by_location(location):
      if not isinstance(location, Location):
          raise TypeError('Invalid `location` parameter.')
  
      airspaces = Airspace.by_location(location)
      return map(airspace_to_dict, airspaces)
  
  
  def airspace_to_dict(airspace):
      return {
          'name': airspace.name,
          'base': airspace.base,
          'top': airspace.top,
          'airspace_class': airspace.airspace_class,
          'country': airspace.country_code,
      }
  
new_contents: from skylines.api.schemas import airspace_list_schema
  from skylines.model import Airspace, Location
  
  
  def get_airspaces_by_location(location):
      if not isinstance(location, Location):
          raise TypeError('Invalid `location` parameter.')
  
      data, errors = airspace_list_schema.dump(
          Airspace.by_location(location).all(), many=True)
  
      return data
  
subject: Use AirspaceSchema class for serialization