def METHOD_NAME():
    """Extract a SCOP domain's ATOM and HETATOM records from a PDB file."""
    try:
        opts, args = getopt.getopt(
            sys.argv[1:], "hp:o:i:", ["help", "usage", "pdb=", "output=", "input="]
        )
    except getopt.GetoptError:
        # show help information and exit:
        usage()
        sys.exit(2)
    input = None
    in_handle = None
    output = None
    pdb_url = None
    cla_url = None
    raf_url = None
    for o, a in opts:
        if o in ("-h", "--help", "--usage"):
            usage()
            sys.exit()
        elif o in ("-o", "--output"):
            output = a
        elif o in ("-i", "--input"):
            input = a
        elif o in ("-p", "--pdb"):
            pdb_url = a
    if len(args) < 2:
        sys.stderr.write("Not enough arguments. Try --help for more details.\n")
        sys.exit(2)
    raf_url = args[0]
    cla_url = args[1]
    (raf_filename, headers) = _urlretrieve(raf_url)
    seqMapIndex = Raf.SeqMapIndex(raf_filename)
    (cla_filename, headers) = _urlretrieve(cla_url)
    claIndex = Cla.Index(cla_filename)
    if input is None:
        sids = args[2:]
    elif input == "-":
        sids = sys.stdin
    else:
        in_handle = open(input)
        sids = in_handle
    try:
        for sid in sids:
            if not sid or sid[0:1] == "#":
                continue
            id = sid[0:7]
            pdbid = id[1:5]
            s = pdbid[0:1]
            if s == "0" or s == "s":
                sys.stderr.write(f"No coordinates for domain {id}\n")
                continue
            if output is None:
                filename = id + ".ent"
                out_handle = open(filename, "w+")
            elif output == "-":
                out_handle = sys.stdout
            else:
                out_handle = open(output, "w+")
            try:
                try:
                    claRec = claIndex[id]
                    residues = claRec.residues
                    seqMap = seqMapIndex.getSeqMap(residues)
                    pdbid = residues.pdbid
                    f = open_pdb(pdbid, pdb_url)
                    try:
                        seqMap.getAtoms(f, out_handle)
                    finally:
                        f.close()
                except (OSError, KeyError, RuntimeError) as e:
                    sys.stderr.write(f"I cannot do SCOP domain {id} : {e}\n")
            finally:
                out_handle.close()
    finally:
        if in_handle is not None:
            in_handle.close()