docs: def retrieve(pdb_id, cache_dir = None, bio_cache = None):
          '''Creates a FASTA object by using a cached copy of the file if it exists or by retrieving the file from the RCSB.'''
  
          pdb_id = pdb_id.upper()
  
          if bio_cache:
              return FASTA(bio_cache.get_fasta_contents(pdb_id))
  
          # Check to see whether we have a cached copy
          if cache_dir:
              filename = os.path.join(cache_dir, "%s.fasta" % pdb_id)
              if os.path.exists(filename):
                  return FASTA(read_file(filename))
              else:
                  filename += ".txt"
                  if os.path.exists(filename):
                      return FASTA(read_file(filename))
  
          # Get a copy from the RCSB
          contents = rcsb.retrieve_fasta(pdb_id)
  
          # Create a cached copy if appropriate
          if cache_dir:
              write_file(os.path.join(cache_dir, "%s.fasta" % pdb_id), contents)
  
          # Return the object
          return FASTA(contents)