def find_json(raw):
    '''
    Pass in a raw string and load the json when is starts. This allows for a
    string to start with garbage and end with json but be cleanly loaded
    '''
    ret = {}
    for ind in range(len(raw)):
        working = '\n'.join(raw.splitlines()[ind:])
        try:
            ret = json.loads(working, object_hook=decode_dict)
        except __HOLE__:
            continue
        if ret:
            return ret
    if not ret:
        # Not json, raise an error
        raise ValueError
dataset/ETHPy150Open saltstack/salt/salt/utils/__init__.py/find_json