Check if the passed email registered at a free pubic mail server

    :param addr: email address to check
    :return: bool
    >>> is_public("john@cmu.edu")
    False
    >>> is_public("john@gmail.com")
    True

def is_public(addr):
    # type: (Union[str, unicode]) -> bool
    """ Check if the passed email registered at a free pubic mail server

    :param addr: email address to check
    :return: bool
    >>> is_public("john@cmu.edu")
    False
    >>> is_public("john@gmail.com")
    True
    """
    addr_domain = domain(addr)
    if not addr_domain:
        # anybody can use invalid email
        return True
    chunks = addr_domain.rsplit(".", 1)

    return len(chunks) < 2 \
        or addr_domain.endswith("local") \
        or addr_domain in public_domains()