Decorator for registering shortcode functions.

def register(tag, end_tag=None):
    """ Decorator for registering shortcode functions. """

    def register_function(function):
        tagmap[tag] = {'func': function, 'endtag': end_tag}
        if end_tag:
            tagmap['endtags'].append(end_tag)
        return function

    return register_function