<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def canonical_path(path):
 """ Return a normalized, canonical path to a file or folder. Removes all symbolic links encountered in the path to detect natural mail and maildir duplicates on the fly. """

        return os.path.normcase(os.path.realpath(os.path.abspath(
            os.path.expanduser(path))))