code: def add_error_class(klass, code):
      
      if not isinstance(code, python.str_types):
          code = code.decode('utf-8')
  
      if not isinstance(klass, python.class_types):
          raise TypeError("klass must be a class type")
  
      mro = inspect.getmro(klass)
  
      if not Exception in mro:
          raise TypeError(
              'Error classes must subclass the __builtin__.Exception class')
  
      if code in ERROR_CLASS_MAP:
          raise ValueError('Code %s is already registered' % (code,))
  
      ERROR_CLASS_MAP[code] = klass
docs: Maps an exception class to a string code. Used to map remoting C{onStatus}
      objects to an exception class so that an exception can be built to
      represent that error.
  
      An example::
  
          >>> class AuthenticationError(Exception):
          ...     pass
          ...
          >>> pyamf.add_error_class(AuthenticationError, 'Auth.Failed')
          >>> print pyamf.ERROR_CLASS_MAP
          {'TypeError': <type 'exceptions.TypeError'>, 'IndexError': <type 'exceptions.IndexError'>,
          'Auth.Failed': <class '__main__.AuthenticationError'>, 'KeyError': <type 'exceptions.KeyError'>,
          'NameError': <type 'exceptions.NameError'>, 'LookupError': <type 'exceptions.LookupError'>}
  
      @param klass: Exception class
      @param code: Exception code
      @type code: C{str}
      @see: L{remove_error_class}