def _try_rsplit(text, delim):
    """Helper method for splitting Email Received headers.

    Attempts to rsplit ``text`` with ``delim`` with at most one split.
    returns a tuple of (remaining_text, last_component) if the split was
    successful; otherwise, returns (text, None)
    """
    if delim in text:
        return [x.strip() for x in text.rsplit(delim, 1)]
    else:
        return (text, None)