def fetch_gravatar(email):
 gravatar_url = get_gravatar_url(email)
 try:
  result = urlfetch.fetch(gravatar_url, headers={'Content-Type': 'image/png'}, follow_redirects=False)
 except (urlfetch.InvalidURLError, urlfetch.DownloadError):
  logging.error(('Failed to fetch Gravatar from %s' % gravatar_url))
 else:
  if (result.status_code == 200):
   if (imghdr.what(None, result.content) == 'png'):
    return utils.convert_png_binary_to_data_url(result.content)
  else:
   logging.error(('[Status %s] Failed to fetch Gravatar from %s' % (result.status_code, gravatar_url)))
 return DEFAULT_IDENTICON_DATA_URL

def fetch_gravatar ( email ) : gravatar_url = get_gravatar_url ( email ) try : result = urlfetch . fetch ( gravatar_url , headers = { 'Content-Type' : 'image/png' } , follow_redirects = False ) except ( urlfetch . InvalidURLError , urlfetch . DownloadError ) : logging . error ( ( 'Failed to fetch Gravatar from %s' % gravatar_url ) ) else : if ( result . status_code == 200 ) : if ( imghdr . what ( None , result . content ) == 'png' ) : return utils . convert_png_binary_to_data_url ( result . content ) else : logging . error ( ( '[Status %s] Failed to fetch Gravatar from %s' % ( result . status_code , gravatar_url ) ) ) return DEFAULT_IDENTICON_DATA_URL
returns the gravatar corresponding to the users email .