from jinja2.runtime import Undefined


def domainname(string):
    """Return just the domain portion of *string* or ``Undefined``."""

    try:
        return string.split('.', 1)[1]
    except IndexError:
        return Undefined(hint=f"No domain in {string!r}")