'Register the typing of a global value.
Functional usage with a Numba type::
register_global(value, typ)
Decorator usage with a template class::
@register_global(value, typing_key=None)
class Template:'

def register_global(self, val=None, typ=None, **kwargs):

    if (typ is not None):
        assert (val is not None)
        assert (not kwargs)
        self.globals.append((val, typ))
    else:
        def decorate(cls, typing_key):
            class Template(cls, ):
                key = typing_key
            if callable(val):
                typ = types.Function(Template)
            else:
                raise TypeError('cannot    infer    type    for    global    value    %r')
            self.globals.append((val, typ))
            return cls
        assert (val is not None)
        typing_key = kwargs.pop('typing_key', val)
        assert (not kwargs)
        if (typing_key is val):
            mod = sys.modules[val.__module__]
            if (getattr(mod, val.__name__) is not val):
                raise ValueError(("%r    is    not    globally    reachable    as    '%s.%s'" % (mod, val.__module__, val.__name__)))
        def decorator(cls):
            return decorate(cls, typing_key)
        return decorator
