'Calculate the value of the target parameter from a host header.
Args:
host: A string representing the hostname for this task.
Returns:
A string containing the target of this task, or the constant
DEFAULT_APP_VERSION if it is the default version.
If this code is running in a unit-test where the environment variable
`DEFAULT_VERSION_HOSTNAME\' is not set then the constant
_UNKNOWN_APP_VERSION is returned.'

@staticmethod
def __target_from_host(host):

    default_hostname = app_identity.get_default_version_hostname()
    if (default_hostname is None):
        return _UNKNOWN_APP_VERSION
    if host.endswith(default_hostname):
        version_name = host[:(- (len(default_hostname) + 1))]
        if version_name:
            return version_name
    return DEFAULT_APP_VERSION
