code: def extract_context(annotations, annot_manager):
      
      def get_annot(annotations, key):
          """Return a specific annotation given a key."""
          val = annotations.pop(key, None)
          if val:
              val_list = [v for v, tf in val.items() if tf]
              if len(val_list) > 1:
                  logger.warning('More than one "%s" in annotations' % key)
              elif not val_list:
                  return None
              return val_list[0]
          return None
  
      bc = BioContext()
      species = get_annot(annotations, 'Species')
      if species:
          name = annot_manager.get_mapping('Species', species)
          bc.species = RefContext(name=name, db_refs={'TAXONOMY': species})
  
      mappings = (('CellLine', 'cell_line', None),
                  ('Disease', 'disease', None),
                  ('Anatomy', 'organ', None),
                  ('Cell', 'cell_type', None),
                  ('CellStructure', 'location', 'MESH'))
      for bel_name, indra_name, ns in mappings:
          ann = get_annot(annotations, bel_name)
          if ann:
              ref = annot_manager.get_mapping(bel_name, ann)
              if ref is None:
                  continue
              if not ns:
                  db_ns, db_id = ref.split('_', 1)
              else:
                  db_ns, db_id = ns, ref
              setattr(bc, indra_name,
                      RefContext(name=ann, db_refs={db_ns: db_id}))
      # Overwrite blank BioContext
      if not bc:
          bc = None
      return bc
docs: Return a BioContext object extracted from the annotations.
  
      The entries that are extracted into the BioContext are popped from the
      annotations.
  
      Parameters
      ----------
      annotations : dict
          PyBEL annotations dict
      annot_manager : AnnotationManager
          An annotation manager to get name/db reference mappings for each ot the
          annotation types.
  
      Returns
      -------
      bc : BioContext
          An INDRA BioContext object