import ipaddress


def _get_ip_type_str(ip):
    """
    Return the type of the given IP address as string to be used in the scion topology
    files; returns either "IPv4" or "IPv6"
    :param str ip: IP address
    :return str: "IPv4" or "IPv6"
    """
    ip = ipaddress.ip_address(ip)
    if isinstance(ip, ipaddress.IPv6Address):
        return "IPv6"
    else:
        return "IPv4"