Evaluates the savepath with the help of the given url.

        :param str url: url to evaluate the savepath with
        :return str: the evaluated savepath for the given url

def get_savepath(self, url, savepath=None):
        """
        Evaluates the savepath with the help of the given url.

        :param str url: url to evaluate the savepath with
        :return str: the evaluated savepath for the given url
        """
        timestamp = int(time.time())

        if not savepath:
            savepath = self.cfg_savepath

        # lambda is used for lazy evaluation
        savepath = re.sub(re_working_path, lambda match: self.working_path, savepath)

        savepath = re.sub(
            re_time_dl, lambda match: SavepathParser.time_replacer(match, timestamp),
            savepath
        )
        savepath = re.sub(re_timstamp_dl, str(timestamp), savepath)

        savepath = re.sub(
            re_domain, lambda match: UrlExtractor.get_allowed_domain(url, False)
            [:int(match.group(1))], savepath
        )
        savepath = re.sub(
            re_appendmd5_domain, lambda match: SavepathParser.append_md5_if_too_long(
                UrlExtractor.get_allowed_domain(url, False), int(match.group(1))
            ), savepath
        )
        savepath = re.sub(
            re_md5_domain, lambda match: hashlib.md5(
                UrlExtractor.get_allowed_domain(url, False).encode('utf-8')
            ).hexdigest()[:int(match.group(1))], savepath
        )

        savepath = re.sub(
            re_full_domain, lambda match: UrlExtractor.get_allowed_domain(url)
            [:int(match.group(1))], savepath
        )
        savepath = re.sub(
            re_appendmd5_full_domain, lambda match: SavepathParser.append_md5_if_too_long(
                UrlExtractor.get_allowed_domain(url), int(match.group(1))
            ), savepath
        )
        savepath = re.sub(
            re_md5_full_domain, lambda match: hashlib.md5(
                UrlExtractor.get_allowed_domain(url).encode('utf-8')
            ).hexdigest()[:int(match.group(1))], savepath
        )

        savepath = re.sub(
            re_subdomains, lambda match: UrlExtractor.get_subdomain(url)
            [:int(match.group(1))], savepath
        )
        savepath = re.sub(
            re_appendmd5_subdomains, lambda match: SavepathParser.
            append_md5_if_too_long(UrlExtractor.get_subdomain(url), int(match.group(1))),
            savepath
        )
        savepath = re.sub(
            re_md5_subdomains, lambda match: hashlib.md5(
                UrlExtractor.get_subdomain(url).encode('utf-8')
            ).hexdigest()[:int(match.group(1))], savepath
        )

        savepath = re.sub(
            re_url_dir, lambda match: UrlExtractor.get_url_directory_string(url)
            [:int(match.group(1))], savepath
        )
        savepath = re.sub(
            re_appendmd5_url_dir, lambda match: SavepathParser.append_md5_if_too_long(
                UrlExtractor.get_url_directory_string(url), int(match.group(1))
            ), savepath
        )
        savepath = re.sub(
            re_md5_url_dir, lambda match: hashlib.md5(
                UrlExtractor.get_url_directory_string(url).encode('utf-8')
            ).hexdigest()[:int(match.group(1))], savepath
        )

        savepath = re.sub(
            re_url_file, lambda match: UrlExtractor.get_url_file_name(url)
            [:int(match.group(1))], savepath
        )
        savepath = re.sub(
            re_md5_url_file, lambda match: hashlib.md5(
                UrlExtractor.get_url_file_name(url).encode('utf-8')
            ).hexdigest()[:int(match.group(1))], savepath
        )

        abs_savepath = self.get_abs_path(savepath)

        savepath = re.sub(
            re_max_url_file, lambda match: UrlExtractor.get_url_file_name(url)
            [:SavepathParser.get_max_url_file_name_length(abs_savepath)], savepath
        )
        savepath = re.sub(
            re_appendmd5_max_url_file, lambda match: SavepathParser.
            append_md5_if_too_long(
                UrlExtractor.get_url_file_name(url),
                SavepathParser.get_max_url_file_name_length(abs_savepath)
            ), savepath
        )

        # ensure the savepath doesn't contain any invalid characters
        return SavepathParser.remove_not_allowed_chars(savepath)