'Returns the path to the media file on disk for the given URL.
The passed URL is assumed to begin with ``self.base_url``.  If the
resulting file path is outside the media directory, then a ValueError
is raised.'

def file_path(self, url):

    relative_url = url[len(self.base_url[2]):]
    relative_path = urllib.url2pathname(relative_url)
    return safe_join(self.base_dir, relative_path)
