def _to_dict(objects):
 try:
  if isinstance(objects, string_types):
   objects = json.loads(objects)
 except ValueError as err:
  log.error('Could not parse objects: %s', err)
  raise err
 return objects

def _to_dict ( objects ) : try : if isinstance ( objects , string_types ) : objects = json . loads ( objects ) except ValueError as err : log . error ( 'Could not parse objects: %s' , err ) raise err return objects
potentially interprets a string as json for usage with mongo .