trepan/processor/cmdfns.py
def get_onoff(errmsg, arg, default=None, print_error=True):
    """Return True if arg is 'on' or 1 and False arg is 'off' or 0.
    Any other value is raises ValueError."""
    if not arg:
        if default is None:
            if print_error:
                errmsg("Expecting 'on', 1, 'off', or 0. Got nothing.")
                pass
            raise ValueError
        return default
    if arg == '1' or arg == 'on': return True
    if arg == '0' or arg =='off': return False

    if print_error:
        errmsg("Expecting 'on', 1, 'off', or 0. Got: %s." % str(arg))
    raise ValueError
def get_onoff(errmsg, arg, default=None, print_error=True):
    """Return True if arg is 'on' or 1 and False arg is 'off' or 0.
    Any other value is raises ValueError."""
    if not arg:
        if default is None:
            if print_error:
                errmsg("Expecting 'on', 1, 'off', or 0. Got nothing.")
                pass
            raise ValueError
        return default
    if arg == '1' or arg == 'on': return True
    if arg == '0' or arg =='off': return False

    if print_error:
        errmsg("Expecting 'on', 1, 'off', or 0. Got: %s." % str(arg))
    raise ValueError
def get_onoff ( errmsg , arg , default = None , print_error = True ) : if not arg : if default is None : if print_error : errmsg ( "Expecting 'on', 1, 'off', or 0. Got nothing." ) pass raise ValueError return default if arg == '1' or arg == 'on' : return True if arg == '0' or arg == 'off' : return False if print_error : errmsg ( "Expecting 'on', 1, 'off', or 0. Got: %s." % str ( arg ) ) raise ValueError
Return True if arg is 'on' or 1 and False arg is 'off' or 0.
    Any other value is raises ValueError.
Return True if arg is on or 1 and False arg is off or 0 . Any other value is raises ValueError .