def _interpret_output_mode(arg, default='interactive'):
    """
      >>> _interpret_output_mode('Repr_If_Not_None')
      'repr-if-not-none'
    """
    if arg is None:
        arg = default
    rarg = str(arg).strip().lower().replace('-', '').replace('_', '')
    if rarg in ['none', 'no', 'n', 'silent']:
        return 'silent'
    elif rarg in ['interactive', 'i']:
        return 'interactive'
    elif rarg in ['print', 'p', 'string', 'str']:
        return 'str'
    elif rarg in ['repr', 'r']:
        return 'repr'
    elif rarg in ['pprint', 'pp']:
        return 'pprint'
    elif rarg in ['reprifnotnone', 'reprunlessnone', 'rn']:
        return 'repr-if-not-none'
    elif rarg in ['pprintifnotnone', 'pprintunlessnone', 'ppn']:
        return 'pprint-if-not-none'
    elif rarg in ['systemexit', 'exit', 'raise']:
        return 'exit'
    else:
        raise ValueError(
            'Invalid output=%r; expected one of silent/interactive/str/repr/pprint/repr-if-not-none/pprint-if-not-none/exit'
             % (arg,))
