def create_user(ssh_fn, name):
    """Create a user on an instance using the ssh_fn and name.

    The ssh_fn is a function that takes a command and runs it on the remote
    system.  It must be sudo capable so that a user can be created and the
    remote directory for the user be determined.  The directory for the user is
    created in /var/lib/{name}

    :param ssh_fn: a sudo capable ssh_fn that can run commands on the unit.
    :type ssh_fn: Callable[[str], str]
    :param name: the name of the user to create.
    :type name: str
    :returns: the directory of the new user.
    :rtype: str
    """
    dir_ = "/var/lib/{name}".format(name=name)
    cmd = ["sudo", "useradd", "-r", "-s", "/bin/false", "-d", dir_, "-m", name]
    ssh_fn(cmd)
    return dir_.strip()