<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __pathToTuple(self, path):
 """ Convert directory or file path to its tuple identifier. Parameters path : str Path to convert. It can look like /, /directory, /directory/ or /directory/filename. Returns ------- tup_id : tuple Two element tuple identifier of directory/file of (`directory`, `filename`) format. If path leads to main directory, then both fields of tuple will be ``None``. If path leads to a directory, then field `filename` will be ``None``. Raises ------ YTFS.PathConvertError When invalid path is given. """


        if not path or path.count('/') > 2:
            raise YTFS.PathConvertError("Bad path given") # empty or too deep path

        try:
            split = path.split('/')
        except (AttributeError, TypeError):
            raise TypeError("Path has to be string") #path is not a string

        if split[0]:
            raise YTFS.PathConvertError("Path needs to start with '/'") # path doesn't start with '/'.
        del split[0]

        try:
            if not split[-1]: split.pop() # given path ended with '/'.
        except IndexError:
            raise YTFS.PathConvertError("Bad path given") # at least one element in split should exist at the moment

        if len(split) > 2:
            raise YTFS.PathConvertError("Path is too deep. Max allowed level is 2") # should happen due to first check, but ...

        try:
            d = split[0]
        except IndexError:
            d = None
        try:
            f = split[1]
        except IndexError:
            f = None

        if not d and f:
            raise YTFS.PathConvertError("Bad path given") # filename is present, but directory is not #sheeeeeeiiit

        return (d, f)