'Returns file path for an output file based on contents.
Returned path is relative to compressor storage\'s base url, for
example "CACHE/css/58a8c0714e59.css".
When `basename` argument is provided then file name (without extension)
will be used as a part of returned file name, for example:
get_filepath(content, "my_file.css") -> \'CACHE/css/my_file.58a8c0714e59.css\''

def get_filepath(self, content, basename=None):

    parts = []
    if basename:
        filename = os.path.split(basename)[1]
        parts.append(os.path.splitext(filename)[0])
    parts.extend([get_hexdigest(content, 12), self.type])
    return os.path.join(self.output_dir, self.output_prefix, u'.'.join(parts))
