Q:

How can I pare down a PDB file in Python to only include specific residues? 

I'm trying to make a script that will take a MTZ file (reflections), convert it into a CCP4 map, then pare that map down to only encompass a desired area to cut down on the size of my PyMol session files so they're email-able (a.k.a.  not 200 MB) and ease the burden on my POS computer. 
I currently have a Python script that can fft (CCP4) to create the map and mapmask to fix unit cell tiling issues.   What I want to add now is something that can take a PDB file and strip out most of it except, for example, residues within 10 Å of #123. 
I've been looking at ProDy, but not quite sure where to start.   I would also be open to using something in the CCP4 toolkit. 

A:

With the program RasMol, you can select, as Mad Scientist explained it for PyMol, everything in a specific distance around an atom.  RasMol can be run from command line, using a script (with the -script option under UNIX). 

A:

ProDy works quite well, especially from within an existing Python script.   
The following code takes an existing PDB file, performs some selection query on it, then saves it to another file. 
import prody

def pdbsubset(inpdb, outpdb, selection):
    with open(inpdb) as protf:
        prot = prody.parsePDBStream(protf)
    atoms = prot.select(selection)
    prody.writePDB(outpdb, atoms)

An example selection query builder

residues is a list e.g. ['A12', 'A39'] with each element in the form <chain><residue number>.   They were captured from the command line using argparse with 
    parser.add_argument('-i', '--residues', nargs='+')

so you would specify -i A12 A39 or whatever. 

pdb and outpdb are file paths
radius is the distance in angstroms to expand the selection by. 

reslist = ["(chid {0} and resid {1})".format(res[0], res[1:]) for res in residues]
selector = 'within {0} of ({1})'.format(radius, ' or '.join(reslist))

# and running it:
pdbsubset(pdb, outpdb, selector)

The documentation on ProDy selection queries is not the most straightforward, but fairly analogous to PyMol, so doable.