docs: def retrieve_data_from_rcsb(cls, ligand_code, pdb_id = None, silent = True, cached_dir = None):
          '''Retrieve a file from the RCSB.'''
          if not silent:
              colortext.printf("Retrieving data from RCSB")
          if cached_dir:
              assert(os.path.exists(cached_dir))
  
          ligand_info_path, ligand_info, pdb_ligand_info, pdb_ligand_info_path = None, None, None, None
          if cached_dir:
              ligand_info_path = os.path.join(cached_dir, '{0}.cif'.format(ligand_code))
              if os.path.exists(ligand_info_path):
                  ligand_info = read_file(ligand_info_path)
          if not ligand_info:
              ligand_info = retrieve_ligand_cif(ligand_code)
              if cached_dir:
                  write_file(ligand_info_path, ligand_info)
  
          # Parse .cif
          l = cls(ligand_code)
          l.parse_cif(ligand_info)
          l.pdb_id = pdb_id or l.pdb_id
          has_pdb_id = l.pdb_id and (len(l.pdb_id) == 4) and (l.pdb_id != '?')  # the last case is unnecessary and will be short-cut but I included it to show possible values
  
          # Parse PDB XML
          if has_pdb_id:
              if cached_dir:
                  pdb_ligand_info_path = os.path.join(cached_dir, '{0}.pdb.ligandinfo'.format(l.pdb_id.lower()))
                  if os.path.exists(pdb_ligand_info_path):
                      pdb_ligand_info = read_file(pdb_ligand_info_path)
                  else:
                      pdb_ligand_info = retrieve_pdb_ligand_info(l.pdb_id)
                      write_file(pdb_ligand_info_path, pdb_ligand_info)
              else:
                  pdb_ligand_info = retrieve_pdb_ligand_info(l.pdb_id)
          if pdb_ligand_info:
              l.parse_pdb_ligand_info(pdb_ligand_info)
  
          # Retrive the diagram image
          l.get_diagram()
  
          return l