from pathlib import Path


def path(s):
    """
    Returns a :class:`Path` object for the given string.

    :param str s: The string containing the path to parse
    :returns: A :class:`Path` object representing the path
    """
    i = s.rfind('/') + 1
    dirname, basename = s[:i], s[i:]
    if dirname and dirname != '/' * len(dirname):
        dirname = dirname.rstrip('/')
    i = basename.rfind('.')
    if i > 0:
        ext = basename[i:]
    else:
        ext = ''
    return Path(dirname, basename, ext)