<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tar_open(f):
 """Open either a filename or a file-like object as a TarFile. Parameters f : str or file-like object The filename or file-like object from which to read. Returns ------- TarFile A `TarFile` instance. """

    if isinstance(f, six.string_types):
        return tarfile.open(name=f)
    else:
        return tarfile.open(fileobj=f)