def get_thumbnailfile(filename):
    """Given the filename for an image,
    return the path to the thumbnail file.
    Returns None if there is no thumbnail file.
    """
    # Generate the md5 hash of the file uri
    file_hash = hashlib.md5('file://'+filename).hexdigest()

    # the thumbnail file is stored in the ~/.thumbnails/normal folder
    # it is a png file and name is the md5 hash calculated earlier
    tb_filename = os.path.join(os.path.expanduser('~/.thumbnails/normal'),
                               file_hash) + '.png'
    if os.path.exists(tb_filename):
        return tb_filename
    else:
        return None
Given the filename for an image,
    return the path to the thumbnail file.
    Returns None if there is no thumbnail file.
    
recipes/Python/576942_Locate_thumbnail_file/recipe-576942.py