<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def isatty_to_env(cls, stdin, stdout, stderr):
 """Generate nailgun tty capability environment variables based on checking a set of fds. :param file stdin: The stream to check for stdin tty capabilities. :param file stdout: The stream to check for stdout tty capabilities. :param file stderr: The stream to check for stderr tty capabilities. :returns: A dict containing the tty capability environment variables. """

    def gen_env_vars():
      for fd_id, fd in zip(STDIO_DESCRIPTORS, (stdin, stdout, stderr)):
        is_atty = fd.isatty()
        yield (cls.TTY_ENV_TMPL.format(fd_id), cls.encode_env_var_value(int(is_atty)))
        if is_atty:
          yield (cls.TTY_PATH_ENV.format(fd_id), os.ttyname(fd.fileno()) or b'')
    return dict(gen_env_vars())