code: def serialize(obj, **options):
      '''
      Serialize Python data to JSON.
  
      :param obj: the data structure to serialize
      :param options: options given to lower json/simplejson module.
      '''
  
      try:
          if 'fp' in options:
              return salt.utils.json.dump(obj, _json_module=_json, **options)
          else:
              return salt.utils.json.dumps(obj, _json_module=_json, **options)
      except Exception as error:
          raise SerializationError(errorf serialize(obj, **options):
      '''
      Serialize Python data to JSON.
  
      :param obj: the data structure to serialize
      :param options: options given to lower json/simplejson module.
      '''
  
      try:
          if 'fp' in options:
              return salt.utils.json.dump(obj, _json_module=_json, **options)
          else:
              return salt.utils.json.dumps(obj, _json_module=_json, **options)
      except Exception as error:
          raise SerializationError(error)
docs: Serialize Python data to JSON.
  
      :param obj: the data structure to serialize
      :param options: options given to lower json/simplejson module.