docs: def retrieve(pdb_id, cache_dir = None, acceptable_sequence_percentage_match = 70.0, require_uniprot_residue_mapping = True, bio_cache = None):
          '''Creates a PDBML object by using a cached copy of the files if they exists or by retrieving the files from the RCSB.
             bio_cache should be a klab.bio.cache.py::BioCache object and is used to avoid reading/downloading cached files repeatedly.
          '''
  
          pdb_contents = None
          xml_contents = None
          pdb_id = pdb_id.upper()
  
          l_pdb_id = pdb_id.lower()
  
          if len(pdb_id) != 4 or not pdb_id.isalnum():
              raise Exception("Bad PDB identifier '%s'." % pdb_id)
  
          if bio_cache:
              pdb_contents = bio_cache.get_pdb_contents(pdb_id)
              xml_contents = bio_cache.get_sifts_xml_contents(pdb_id)
  
          if cache_dir:
              if not pdb_contents:
                  # Check to see whether we have a cached copy of the PDB file
                  filename = os.path.join(cache_dir, "%s.pdb" % pdb_id)
                  if os.path.exists(filename):
                      pdb_contents = read_file(filename)
  
              if not xml_contents:
                  # Check to see whether we have a cached copy of the XML file
                  filename = os.path.join(cache_dir, "%s.sifts.xml.gz" % l_pdb_id)
                  if os.path.exists(filename):
                      xml_contents = read_file(filename)
  
          # Get any missing files from the RCSB and create cached copies if appropriate
          if not pdb_contents:
              pdb_contents = rcsb.retrieve_pdb(pdb_id)
              if cache_dir:
                  write_file(os.path.join(cache_dir, "%s.pdb" % pdb_id), pdb_contents)
  
          if not xml_contents:
              try:
                  xml_contents = retrieve_xml(pdb_id, silent = False)
                  if cache_dir:
                      write_file(os.path.join(cache_dir, "%s.sifts.xml.gz" % l_pdb_id), xml_contents)
              except FTPException550:
                  raise MissingSIFTSRecord('The file "%s.sifts.xml.gz" could not be found on the EBI FTP server.' % l_pdb_id)
  
          xml_contents = xml_contents
  
          # Return the object
          handler = SIFTS(xml_contents, pdb_contents, acceptable_sequence_percentage_match = acceptable_sequence_percentage_match, cache_dir = cache_dir, require_uniprot_residue_mapping = require_uniprot_residue_mapping, bio_cache = bio_cache, pdb_id = pdb_id)
          xml.sax.parseString(xml_contents, handler)
          return handler