<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fetch(self, url, path):
 """ Downloads the given url. :param url: The url to be downloaded. :type url: String :param path: The directory path to where the image should be stored :type path: String :param filename: The filename that has to be downloaded :type filename: String :returns: Boolean """


        segments = url.split('/')
        filename = segments[-1]

        # remove query parameters from the filename
        filename = filename.split('?')[0]

        self.output('Downloading: %s' % filename, normal=True, arrow=True)

        # print(join(path, filename))
        # raise Exception
        if exists(join(path, filename)):
            size = getsize(join(path, filename))
            if size == self.get_remote_file_size(url):
                self.output('%s already exists on your system' % filename, normal=True, color='green', indent=1)

        else:
            fetch(url, path)
        self.output('stored at %s' % path, normal=True, color='green', indent=1)

        return join(path, filename)