<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_profile(profile, fqa, zone_file, address, public_key):
 """ Process profile data and 1) Insert verifications 2) Check if profile data is valid JSON """

    
    # if the zone file is a string, then parse it 
    if isinstance(zone_file, (str,unicode)):
        try:
            zone_file = blockstack_zones.parse_zone_file(zone_file)
        except:
            # leave as text
            pass

    data = {'profile' : profile,
            'zone_file' : zone_file,
            'public_key': public_key,
            'owner_address' : address}

    if not fqa.endswith('.id'):
        data['verifications'] = ["No verifications for non-id namespaces."]
        return data

    profile_in_legacy_format = is_profile_in_legacy_format(profile)

    if not profile_in_legacy_format:
        data['verifications'] = fetch_proofs(data['profile'], fqa, address,
                                             profile_ver=3, zonefile=zone_file)
    else:
        if type(profile) is not dict:
            data['profile'] = json.loads(profile)
        data['verifications'] = fetch_proofs(data['profile'], fqa, address)

    return data