'Register a new encoder/decoder.
Arguments:
name (str): A convenience name for the serialization method.
encoder (callable): A method that will be passed a python data
structure and should return a string representing the
serialized data.  If :const:`None`, then only a decoder
will be registered. Encoding will not be possible.
decoder (Callable): A method that will be passed a string
representing serialized data and should return a python
data structure.  If :const:`None`, then only an encoder
will be registered.  Decoding will not be possible.
content_type (str): The mime-type describing the serialized
structure.
content_encoding (str): The content encoding (character set) that
the `decoder` method will be returning. Will usually be
`utf-8`, `us-ascii`, or `binary`.'

def register(self, name, encoder, decoder, content_type, content_encoding=u'utf-8'):

    if encoder:
        self._encoders[name] = codec(content_type, content_encoding, encoder)
    if decoder:
        self._decoders[content_type] = decoder
    self.type_to_name[content_type] = name
    self.name_to_type[name] = content_type
