code: def author_to_dict(obj):
      
      def default():
          raise RuntimeError("unsupported type {t}".format(t=type(obj).__name__))
  
      # a more pythonic way to handle this would be several try blocks to catch
      # missing attributes
      return {
          # GitAuthor has name,email,date properties
          'GitAuthor': lambda x: {'name': x.name, 'email': x.email},
          # InputGitAuthor only has _identity, which returns a dict
          # XXX consider trying to rationalize this upstream...
          'InputGitAuthor': lambda x: x._identity,
      }.get(type(obj).__name__, lambda x: default())(obj)
docs: Who needs a switch/case statement when you can instead use this easy to
      comprehend drivel?