def to_signum(signum):
    """Resolves the signal number from arbitrary signal representation.

     Supported formats:
        10 - plain integers
        '10' - integers as a strings
        'KILL' - signal names
        'SIGKILL' - signal names with SIG prefix
        'SIGRTMIN+1' - signal names with offsets
    """
    if isinstance(signum, int):
        return signum

    m = re.match(r'(\w+)(\+(\d+))?', signum)
    if m:
        name = m.group(1).upper()
        if not name.startswith('SIG'):
            name = 'SIG' + name

        offset = int(m.group(3)) if m.group(3) else 0

        try:
            return getattr(signal, name) + offset
        except __HOLE__:
            pass

    raise ValueError('signal invalid: {}'.format(signum))
dataset/ETHPy150Open circus-tent/circus/circus/util.py/to_signum