<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def canonicalize_path(path):
 """Canonicalizes a potential path. Returns a binary string encoded into filesystem encoding. """

    if isinstance(path, six.binary_type):
        return path
    if isinstance(path, six.text_type):
        return _fsencode(path)
    else:
        return canonicalize_path(str(path))