<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def thumbnail_exists(self, thumbnail_name):
 """ Calculate whether the thumbnail already exists and that the source is not newer than the thumbnail. If the source and thumbnail file storages are local, their file modification times are used. Otherwise the database cached modification times are used. """

        if self.remote_source:
            return False

        if utils.is_storage_local(self.source_storage):
            source_modtime = utils.get_modified_time(
                self.source_storage, self.name)
        else:
            source = self.get_source_cache()
            if not source:
                return False
            source_modtime = source.modified

        if not source_modtime:
            return False

        local_thumbnails = utils.is_storage_local(self.thumbnail_storage)
        if local_thumbnails:
            thumbnail_modtime = utils.get_modified_time(
                self.thumbnail_storage, thumbnail_name)
            if not thumbnail_modtime:
                return False
            return source_modtime <= thumbnail_modtime

        thumbnail = self.get_thumbnail_cache(thumbnail_name)
        if not thumbnail:
            return False
        thumbnail_modtime = thumbnail.modified

        if thumbnail.modified and source_modtime <= thumbnail.modified:
            return thumbnail
        return False