def get_canonical_absolute_expanded_path(path):
    """Get the canonical form of the absolute path from a possibly relative path
    (which may have symlinks, etc.)"""
    return os.path.normcase(
               os.path.normpath(
                   os.path.realpath( # remove any symbolic links
                       os.path.abspath( # may not be needed with realpath, to be safe
                           os.path.expanduser(path)))))
Get the canonical form of the absolute path from a possibly relative path
    (which may have symlinks, etc.)