def redact_email(email):
    """
    cut out the domain for an email if there is one

    We still show up to 4 character of the top level domain (including the .)
    For everything else in the domain, just replace with ***
    Return '****' if email is misformatted
    """
    if len(email.split('@')) != 2:
        return '****'
    user, host = email.split('@')
    tld = host.split('.')[-1]
    if len(host.split('.')) < 2:
        return user + '@' + '****'
    return user + '@' + '***' + ('.' + tld)[-4:]