code: def convert_enamldef_def_to_func(token_stream):
      
      in_enamldef = False
      depth = 0
      for tok in token_stream:
          if tok.type == 'ENAMLDEF':
              in_enamldef = True
          elif tok.type == 'INDENT':
              depth += 1
          elif in_enamldef and tok.type == 'DEF':
              # Since functions are not allowed on the RHS we can
              # transform the token type to a NAME so it's picked up by the
              # parser as a decl_funcdef instead of funcdef
              tok.type = 'NAME'
              tok.value = 'func'
          elif tok.type == 'DEDENT':
              depth -= 1
              if depth == 0:
                  in_enamldef = False
          yield tok
docs: A token stream processor which processes all enaml declarative functions 
      to allow using `def` instead of `func`. It does this by transforming DEF 
      tokens to NAME within enamldef blocks and then changing the token value to 
      `func`.
      
      Notes
      ------
      Use this at your own risk!  This was a feature intentionally
      dismissed by the author of enaml because declarative func's are not the
      same as python functions.