docs: def get_person_from_legacy_format(profile_record):
      """
      Given a whole profile, convert it into 
      zone-file format.  In the full profile JSON,
      this method operates on the 'data_record' object.
  
      @profile is a dict that contains the legacy profile data
  
      Return a dict with the zone-file formatting.
      """
  
      if not is_profile_in_legacy_format(profile_record):
          raise ValueError("Not a legacy profile")
  
      profile = profile_record
  
      try:
          profile = json.loads(json.dumps(profile))
      except ValueError:
          pass
  
      images = []
      accounts = []
      profile_data = {
          "@type": "Person"
      }
  
      if profile.has_key("name") and type(profile["name"]) == dict \
              and profile["name"].has_key("formatted"):
          profile_data["name"] = profile["name"]["formatted"]
  
      if profile.has_key("bio"):
          profile_data["description"] = profile["bio"]
  
      if profile.has_key("location") and type(profile["location"]) == dict \
              and profile["location"].has_key("formatted"):
          profile_data["address"] = {
              "@type": "PostalAddress",
              "addressLocality": profile["location"]["formatted"]
          }
  
      if profile.has_key("avatar") and type(profile["avatar"]) == dict and \
              profile["avatar"].has_key("url"):
          images.append({
              "@type": "ImageObject",
              "name": "avatar",
              "contentUrl": profile["avatar"]["url"]
          })
  
      if profile.has_key("cover") and type(profile["cover"]) == dict and \
              profile["cover"].has_key("url"):
          images.append({
              "@type": "ImageObject",
              "name": "cover",
              "contentUrl": profile["cover"]["url"]
          })
  
      if len(images) > 0:
          profile_data["image"] = images
  
      if profile.has_key("website") and type(profile["website"]) in [str, unicode]:
          profile_data["website"] = [{
              "@type": "WebSite",
              "url": profile["website"]
          }]
  
      for service_name in ["twitter", "facebook", "github"]:
          if profile.has_key(service_name):
              accounts.append(
                  format_account(service_name, profile[service_name])
              )
  
      if profile.has_key("bitcoin") and type(profile["bitcoin"]) == dict and \
              profile["bitcoin"].has_key("address"):
          accounts.append({
              "@type": "Account",
              "role": "payment",
              "service": "bitcoin",
              "identifier": profile["bitcoin"]["address"]
          })
  
      if profile.has_key("auth"):
          if len(profile["auth"]) > 0 and type(profile["auth"]) == dict:
              if profile["auth"][0].has_key("publicKeychain"):
                  accounts.append({
                      "@type": "Account",
                      "role": "key",
                      "service": "bip32",
                      "identifier": profile["auth"][0]["publicKeychain"]
                  })
  
      if profile.has_key("pgp") and type(profile["pgp"]) == dict \
              and profile["pgp"].has_key("url") \
              and profile["pgp"].has_key("fingerprint"):
          accounts.append({
              "@type": "Account",
              "role": "key",
              "service": "pgp",
              "identifier": profile["pgp"]["fingerprint"],
              "contentUrl": profile["pgp"]["url"]
          })
  
      profile_data["account"] = accounts 
  
      return profile_data