'Register a new tag with this serializer.
:param tag_class: tag class to register. Will be instantiated with this
serializer instance.
:param force: overwrite an existing tag. If false (default), a
:exc:`KeyError` is raised.
:param index: index to insert the new tag in the tag order. Useful when
the new tag is a special case of an existing tag. If -1 (default),
the tag is appended to the end of the order.
:raise KeyError: if the tag key is already registered and ``force`` is
not true.'

def register(self, tag_class, force=False, index=(-1)):

    tag = tag_class(self)
    key = tag.key
    if (key is not None):
        if ((not force) and (key in self.tags)):
            raise KeyError("Tag    '{0}'    is    already    registered.".format(key))
        self.tags[key] = tag
    if (index == (-1)):
        self.order.append(tag)
    else:
        self.order.insert(index, tag)
