def METHOD_NAME(default=DEFAULT_HOSTNAME):
    # type: (Union[T, str]) -> Union[T, str]
    hostname = os.environ.get("DD_AGENT_HOST", os.environ.get("DD_DOGSTATSD_HOST", default))
    return "[{}]".format(hostname) if is_ipv6_hostname(hostname) else hostname