def getenv_escaped(key: str, default: str = None) -> Optional[str]:
    """
    Returns an environment variable's value, CGI-escaped, or ``None``.
    """
    value = os.getenv(key, default)
    # noinspection PyDeprecation
    return cgi.escape(value) if value is not None else None
def getenv_escaped ( key : str , default : str = None ) -> Optional [ str ] : value = os . getenv ( key , default ) return cgi . escape ( value ) if value is not None else None
Returns an environment variable's value, CGI-escaped, or ``None``.