def GetMedicationHTML(feed):
 if (not feed.entry):
  return '<b>No entries in feed</b><br>'
 html = []
 for entry in feed.entry:
  try:
   ccr = entry.FindExtensions('ContinuityOfCareRecord')[0]
   body = ccr.FindChildren('Body')[0]
   meds = body.FindChildren('Medications')[0].FindChildren('Medication')
   for med in meds:
    name = med.FindChildren('Product')[0].FindChildren('ProductName')[0]
    html.append(('<li>%s</li>' % name.FindChildren('Text')[0].text))
  except:
   html.append('<b>No medication data in this profile</b><br>')
 return ('<ul>%s</ul>' % ''.join(html))

def GetMedicationHTML ( feed ) : if ( not feed . entry ) : return '<b>No entries in feed</b><br>' html = [ ] for entry in feed . entry : try : ccr = entry . FindExtensions ( 'ContinuityOfCareRecord' ) [ 0 ] body = ccr . FindChildren ( 'Body' ) [ 0 ] meds = body . FindChildren ( 'Medications' ) [ 0 ] . FindChildren ( 'Medication' ) for med in meds : name = med . FindChildren ( 'Product' ) [ 0 ] . FindChildren ( 'ProductName' ) [ 0 ] html . append ( ( '<li>%s</li>' % name . FindChildren ( 'Text' ) [ 0 ] . text ) ) except : html . append ( '<b>No medication data in this profile</b><br>' ) return ( '<ul>%s</ul>' % '' . join ( html ) )
prints out the users medication to the console .