code: def fetch_pdb(pdbid):
      
      pdbid = pdbid.lower()
      write_message('\nChecking status of PDB ID %s ... ' % pdbid)
      state, current_entry = check_pdb_status(pdbid)  # Get state and current PDB ID
  
      if state == 'OBSOLETE':
          write_message('entry is obsolete, getting %s instead.\n' % current_entry)
      elif state == 'CURRENT':
          write_message('entry is up to date.\n')
      elif state == 'UNKNOWN':
          sysexit(3, 'Invalid PDB ID (Entry does not exist on PDB server)\n')
      write_message('Downloading file from PDB ... ')
      pdburl = 'http://www.rcsb.org/pdb/files/%s.pdb' % current_entry  # Get URL for current entry
      try:
          pdbfile = urlopen(pdburl).read().decode()
          # If no PDB file is available, a text is now shown with "We're sorry, but ..."
          # Could previously be distinguished by an HTTP error
          if 'sorry' in pdbfile:
              sysexit(5, "No file in PDB format available from wwPDB for the given PDB ID.\n")
      except HTTPError:
          sysexit(5, "No file in PDB format available from wwPDB for the given PDB ID.\n")
      return [pdbfile, current_entry]
docs: Get the newest entry from the RCSB server for the given PDB ID. Exits with '1' if PDB ID is invalid.