code: def format_keys(obj, format_type=None):
      
      warnings.warn(
          "`format_keys` function and `JSON_API_FORMAT_KEYS` setting are deprecated and will be "
          "removed in the future. "
          "Use `format_field_names` and `JSON_API_FORMAT_FIELD_NAMES` instead. Be aware that "
          "`format_field_names` only formats keys and preserves value.",
          DeprecationWarning
      )
  
      if format_type is None:
          format_type = json_api_settings.FORMAT_KEYS
  
      if format_type in ('dasherize', 'camelize', 'underscore', 'capitalize'):
  
          if isinstance(obj, dict):
              formatted = OrderedDict()
              for key, value in obj.items():
                  if format_type == 'dasherize':
                      # inflection can't dasherize camelCase
                      key = inflection.underscore(key)
                      formatted[inflection.dasherize(key)] \
                          = format_keys(value, format_type)
                  elif format_type == 'camelize':
                      formatted[inflection.camelize(key, False)] \
                          = format_keys(value, format_type)
                  elif format_type == 'capitalize':
                      formatted[inflection.camelize(key)] \
                          = format_keys(value, format_type)
                  elif format_type == 'underscore':
                      formatted[inflection.underscore(key)] \
                          = format_keys(value, format_type)
              return formatted
          if isinstance(obj, list):
              return [format_keys(item, format_type) for item in obj]
          else:
              return obj
      else:
          return obj
docs: .. warning::
  
          `format_keys` function and `JSON_API_FORMAT_KEYS` setting are deprecated and will be
          removed in the future.
          Use `format_field_names` and `JSON_API_FORMAT_FIELD_NAMES` instead. Be aware that
          `format_field_names` only formats keys and preserves value.
  
      Takes either a dict or list and returns it with camelized keys only if
      JSON_API_FORMAT_KEYS is set.
  
      :format_type: Either 'dasherize', 'camelize', 'capitalize' or 'underscore'