Turn a pass argument into the correct option

def _arg2opt(arg):
    '''
    Turn a pass argument into the correct option
    '''
    res = [o for o, a in option_toggles.items() if a == arg]
    res += [o for o, a in option_flags.items() if a == arg]
    return res[0] if res else None