<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def parse_labels(result):
    '''fix up the labels, meaning parse to json if needed, and return
       original updated object

       Parameters
       ==========
       result: the json object to parse from inspect
    '''

    if "data" in result:
        labels = result['data']['attributes'].get('labels') or {}

    elif 'attributes' in result:
        labels = result['attributes'].get('labels') or {}

    # If labels included, try parsing to json

    try:
        labels = jsonp.loads(labels)
    except:
        pass

    if "data" in result:
        result['data']['attributes']['labels'] = labels
    else:
        result['attributes']['labels'] = labels

    return result