import signal


def signal_number_to_name(signum):
    """
    Given an OS signal number, returns a signal name.  If the signal
    number is unknown, returns ``'UNKNOWN'``.
    """
    # Since these numbers and names are platform specific, we use the
    # builtin signal module and build a reverse mapping.

    signal_to_name_map = dict((k, v) for v, k in signal.__dict__.items()
                              if v.startswith('SIG'))

    return signal_to_name_map.get(signum, 'UNKNOWN')