Get rule files in a directory

def getfiles(qfiles, dirname, names):
    """Get rule files in a directory"""
    for name in names:
        fullname = os.path.join(dirname, name)
        if os.path.isfile(fullname) and \
            fullname.endswith('.cf') or \
                fullname.endswith('.post'):
            qfiles.put(fullname)