code: def get_profile(fqa):
      
  
      profile_expired_grace = False
  
      fqa = fqa.lower()
  
      try:
          try:
              res = blockstack.lib.client.resolve_profile(
                      fqa, include_name_record=True, hostport=blockstack_indexer_url)
          except ValueError:
              # invalid name 
              res = {'error': 'Invalid name', 'status_code': 400}
  
          if 'error' in res:
              log.error('Error from profile.get_profile: {}'.format(res['error']))
              if "no user record hash defined" in res['error']:
                  res['status_code'] = 404
              if "Failed to load user profile" in res['error']:
                  res['status_code'] = 404
  
              if res.get('http_status'):
                  # pass along 
                  res['status_code'] = res['http_status']
                  del res['http_status']
  
              return res
  
          log.warn(json.dumps(res['name_record']))
  
          profile = res['profile']
          zonefile = res['zonefile']
          public_key = res.get('public_key', None)
          address = res['name_record']['address']
  
          if 'expired' in res['name_record'] and res['name_record']['expired']:
              profile_expired_grace = True
  
      except Exception as e:
          log.exception(e)
          abort(500, json.dumps({'error': 'Server error fetching profile'}))
  
      if profile is None or 'error' in zonefile:
          log.error("{}".format(zonefile))
          abort(404)
  
      prof_data = {'response' : profile}
  
      data = format_profile(prof_data['response'], fqa, zonefile, address, public_key)
  
      if profile_expired_grace:
          data['expired'] = (
              'This name has expired! It is still in the renewal grace period, ' +
              'but must be renewed or it will eventually expire and be available' +
              ' for others to register.')
  
      return data
docs: Given a fully-qualified username (username.namespace)
          get the data associated with that fqu.
          Return cached entries, if possible.