code: def write_header(term='bash', tree_dir=None, name=None):
      ''' Write proper file header in a given shell format
  
      Parameters:
          term (str):
              The type of shell header to write, can be "bash", "tsch", or "modules"
          tree_dir (str):
              The path to this repository
          name (str):
              The name of the configuration
  
      Returns:
          A string header to insert
      '''
  
      assert term in ['bash', 'tsch', 'modules'], 'term must be either bash, tsch, or module'
  
      product_dir = tree_dir.rstrip('/')
      base = 'export' if term == 'bash' else 'setenv'
  
      if term != 'modules':
          hdr = .format(name, term, base, product_dir)
      else:
          hdr = """#%Module1.0
  proc ModulesHelp {{ }} {{
      global product version
      puts stderr "This module adds $product/$version to various paths"
  }}
  set name tree
  set product tree
  set version {1}
  conflict $product
  module-whatis "Sets up $product/$version in your environment"
  
  set PRODUCT_DIR {0}
  setenv [string toupper $product]_DIR $PRODUCT_DIR
  setenv [string toupper $product]_VER $version
  prepend-path PATH $PRODUCT_DIR/bin
  prepend-path PYTHONPATH $PRODUCT_DIR/python
  
                  """.format(product_dir, name)
  
      return hdr.strip()
docs: Write proper file header in a given shell format
  
      Parameters:
          term (str):
              The type of shell header to write, can be "bash", "tsch", or "modules"
          tree_dir (str):
              The path to this repository
          name (str):
              The name of the configuration
  
      Returns:
          A string header to insert