<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def split_ref_from_uri(uri):
 # type: (AnyStr) -> Tuple[AnyStr, Optional[AnyStr]] """ Given a path or URI, check for a ref and split it from the path if it is present, returning a tuple of the original input and the ref or None. :param AnyStr uri: The path or URI to split :returns: A 2-tuple of the path or URI and the ref :rtype: Tuple[AnyStr, Optional[AnyStr]] """

    if not isinstance(uri, six.string_types):
        raise TypeError("Expected a string, received {0!r}".format(uri))
    parsed = urllib_parse.urlparse(uri)
    path = parsed.path
    ref = None
    if "@" in path:
        path, _, ref = path.rpartition("@")
    parsed = parsed._replace(path=path)
    return (urllib_parse.urlunparse(parsed), ref)