def write_pids(filename, pids):
    """write PID's to a file.

    parameters:
        - filename: the name of the PID file
        - pids    : a list of pairs, each pair a PID and the corresponding
                    command
    """
    fh = open(filename, 'w')
    for pid, cmd in pids:
        fh.write('%6d %s\n' % (pid, cmd))
    fh.close()
