code: def format(obj, indent=0):
      
      if isinstance(obj, TypeDefinition):
          return _format_typedef(obj, indent)
      elif isinstance(obj, Conjunction):
          return _format_conjunction(obj, indent)
      elif isinstance(obj, Term):
          return _format_term(obj, indent)
      elif isinstance(obj, _MorphSet):
          return _format_morphset(obj, indent)
      elif isinstance(obj, _Environment):
          return _format_environment(obj, indent)
      elif isinstance(obj, FileInclude):
          return _format_include(obj, indent)
      else:
          raise ValueError('cannot format object as TDL: {!r}'.format(obj))
docs: Serialize TDL objects to strings.
  
      Args:
          obj: instance of :class:`Term`, :class:`Conjunction`, or
              :class:`TypeDefinition` classes or subclasses
          indent (int): number of spaces to indent the formatted object
      Returns:
          str: serialized form of *obj*
      Example:
          >>> conj = tdl.Conjunction([
          ...     tdl.TypeIdentifier('lex-item'),
          ...     tdl.AVM([('SYNSEM.LOCAL.CAT.HEAD.MOD',
          ...               tdl.ConsList(end=tdl.EMPTY_LIST_TYPE))])
          ... ])
          >>> t = tdl.TypeDefinition('non-mod-lex-item', conj)
          >>> print(format(t))
          non-mod-lex-item := lex-item &
            [ SYNSEM.LOCAL.CAT.HEAD.MOD < > ].