import socket


def valid_ipv6(addr):
    """Is the string a valid IPv6 address?

    >>> valid_ipv6('::1')
    True
    >>> valid_ipv6('127.0.0.1')
    False
    """
    try:
        socket.inet_pton(socket.AF_INET6, addr)
        return True
    except socket.error:
        return False