code: def parse_abstract(xml_dict):
          
          key_path = ['PubmedArticleSet', 'PubmedArticle', 'MedlineCitation',
                      'Article', 'Abstract', 'AbstractText']
          abstract_xml = reduce(dict.get, key_path, xml_dict)
  
          abstract_paragraphs = []
  
          if isinstance(abstract_xml, str):
              abstract_paragraphs.append(abstract_xml)
  
          elif isinstance(abstract_xml, dict):
              abstract_text = abstract_xml.get('#text')
              try:
                  abstract_label = abstract_xml['@Label']
              except KeyError:
                  abstract_paragraphs.append(abstract_text)
              else:
                  abstract_paragraphs.append(
                      "{}: {}".format(abstract_label, abstract_text))
  
          elif isinstance(abstract_xml, list):
              for abstract_section in abstract_xml:
                  try:
                      abstract_text = abstract_section['#text']
                  except KeyError:
                      abstract_text = abstract_section
  
                  try:
                      abstract_label = abstract_section['@Label']
                  except KeyError:
                      abstract_paragraphs.append(abstract_text)
                  else:
                      abstract_paragraphs.append(
                          "{}: {}".format(abstract_label, abstract_text))
  
          else:
              raise RuntimeError("Error parsing abstract.")
  
          return "\n\n".join(abstract_paragraphs)
docs: Parse PubMed XML dictionary to retrieve abstract.