code: def get_code(shell=None, prog_name=None, env_name=None, extra_env=None):
      
      from jinja2 import Environment, FileSystemLoader
      if shell in [None, 'auto']:
          shell = get_auto_shell()
      if not isinstance(shell, Shell):
          shell = Shell[shell]
      prog_name = prog_name or click.get_current_context().find_root().info_name
      env_name = env_name or '_%s_COMPLETE' % prog_name.upper().replace('-', '_')
      extra_env = extra_env if extra_env else {}
      env = Environment(loader=FileSystemLoader(os.path.dirname(__file__)))
      template = env.get_template('%s.j2' % shell.name)
      return template.render(prog_name=prog_name, complete_var=env_name, extra_env=extra_env)
docs: Returns the completion code to be evaluated by the shell
  
      Parameters
      ----------
      shell : Shell
          The shell type (Default value = None)
      prog_name : str
          The program name on the command line (Default value = None)
      env_name : str
          The environment variable used to control the completion (Default value = None)
      extra_env : dict
          Some extra environment variables to be added to the generated code (Default value = None)
  
      Returns
      -------
      str
          The code to be evaluated by the shell