def get_hostname_prefix():
parts = []<EOL>version = modules.get_current_version_name()<EOL>default_version = modules.get_default_version()<EOL>if version != default_version:<EOL><INDENT>parts.append(version)<EOL><DEDENT>module = modules.get_current_module_name()<EOL>if module != '<STR_LIT:default>':<EOL><INDENT>parts.append(module)<EOL><DEDENT>if parts:<EOL><INDENT>parts.append('<STR_LIT>')<EOL><DEDENT>return '<STR_LIT>'.join(parts)<EOL>
Returns the hostname prefix of a running Endpoints service.

    The prefix is the portion of the hostname that comes before the API name.
    For example, if a non-default version and a non-default service are in use,
    the returned result would be '{VERSION}-dot-{SERVICE}-'.

    Returns:
      str, the hostname prefix.