<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replaceext(filepath, new_ext):
 """Replace any existing file extension with a new one Example:: '/foo/bar.py' '/foo/bar.doc' Args: filepath (str, path):
 file path new_ext (str):
 new file extension; if a leading dot is not included, it will be added. Returns: Tuple[str] """

    if new_ext and new_ext[0] != '.':
        new_ext = '.' + new_ext

    root, ext = os.path.splitext(safepath(filepath))
    return root + new_ext