Potentially interprets a string as JSON for usage with mongo

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

    return objects