def find_rootfs(conn, disk_root):
    """
    Find the image's device root filesystem, and return its path.

    1. Use :func:`guestfs.GuestFS.inspect_os` method. If it returns more than
        one root filesystem or None, try:
    2. Find an exact match of `disk_root` from
        :func:`guestfs.GuestFS.list_filesystems`, if none is found, try:
    3. Return the device that has the substring `disk_root` contained in it,
        from the output of :func:`guestfs.GuestFS.list_filesystems`.

    Args:
        conn(guestfs.GuestFS): Open GuestFS handle.
        disk_root(str): Root device to search for. Note that by default, if
            guestfs can deduce the filesystem, it will not be used.

    Returns:
        str: root device path

    Raises:
        :exc:`GuestFSError` if no root filesystem was found
    """
    rootfs = conn.inspect_os()
    if not rootfs or len(rootfs) > 1:
        filesystems = conn.list_filesystems()
        if disk_root in filesystems:
            rootfs = [disk_root]
        else:
            rootfs = [fs for fs in filesystems.keys() if disk_root in fs]
            if not rootfs:
                raise GuestFSError(
                    'no root fs {0} could be found from list {1}'.format(
                        disk_root, str(filesystems)
                    )
                )
    return sorted(rootfs)[0]
Find the image's device root filesystem, and return its path.

    1. Use :func:`guestfs.GuestFS.inspect_os` method. If it returns more than
        one root filesystem or None, try:
    2. Find an exact match of `disk_root` from
        :func:`guestfs.GuestFS.list_filesystems`, if none is found, try:
    3. Return the device that has the substring `disk_root` contained in it,
        from the output of :func:`guestfs.GuestFS.list_filesystems`.

    Args:
        conn(guestfs.GuestFS): Open GuestFS handle.
        disk_root(str): Root device to search for. Note that by default, if
            guestfs can deduce the filesystem, it will not be used.

    Returns:
        str: root device path

    Raises:
        :exc:`GuestFSError` if no root filesystem was found