def _clean_direction(dir_list, preprocess=False):
    'Handle None if preprocess, else handles anything not in DIR_STRS.'
    if preprocess:
        return [(UND if (not isinstance(the_dir, str)) else the_dir) for the_dir in dir_list]
    else:
        return [(UND if (the_dir not in DIR_STRS) else the_dir) for the_dir in dir_list]
Handle None if preprocess, else handles anything not in DIR_STRS.
def _clean_direction(dir_list, preprocess=False):
    
    if preprocess:
        return [(UND if (not isinstance(the_dir, str)) else the_dir) for the_dir in dir_list]
    else:
        return [(UND if (the_dir not in DIR_STRS) else the_dir) for the_dir in dir_list]