<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extract(self, target):
 """ Extracts the archive file to given directory. :param target: Target extraction directory. :type target: unicode :return: Method success. :rtype: bool """


        if not foundations.common.path_exists(self.__archive):
            raise foundations.exceptions.FileExistsError("{0} | '{1}' file doesn't exists!".format(
                self.__class__.__name__, self.__archive))

        if not foundations.common.path_exists(target):
            raise foundations.exceptions.DirectoryExistsError("{0} | '{1}' directory doesn't exists!".format(
                self.__class__.__name__, target))

        archive = zipfile.ZipFile(self.__archive)
        content = archive.namelist()

        directories = [item for item in content if item.endswith("/")]
        files = [item for item in content if not item.endswith("/")]

        directories.sort()
        directories.reverse()

        for directory in directories:
            not os.path.isdir(os.path.join(target, directory)) and foundations.io.set_directory(
                os.path.join(target, directory))

        for file in files:
            LOGGER.info("{0} | Extracting '{1}' file!".format(self.__class__.__name__, file))
            with open(os.path.join(target, file), "w") as output:
                buffer = StringIO(archive.read(file))
                bufferSize = 2 ** 20
                data = buffer.read(bufferSize)
                while data:
                    output.write(data)
                    data = buffer.read(bufferSize)
        return True