<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_path(xj_path):
 """Extract the last piece of XJPath. :param str xj_path: A XJPath expression. :rtype: tuple[str|None, str] :return: A tuple where first element is a root XJPath and the second is a last piece of key. """


    res = xj_path.rsplit('.', 1)
    root_key = res[0]
    if len(res) > 1:
        return root_key, res[1]
    else:
        if root_key and root_key != '.':
            return None, root_key
        else:
            raise XJPathError('Path cannot be empty', (xj_path,))