def download_album(self, base_path, user, video_format='mp4', titles=None,
                       photo_title=None):
        """Download an album to the local host.

        Keyword arguments:
          base_path: Path on the filesystem to copy albums to. Each album will
                     be stored in base_path/<album title>. If base_path does not
                     exist, it and each non-existent parent directory will be
                     created.
          user: User whose albums are being retrieved. (Default 'default')
          titles: list or string Title(s) that the album(s) should have.
                  Default None, for all albums.

        """
        def _get_download_info(photo_or_video, video_format):
            """Get download link and extension for photo or video.

            video_format must be in DOWNLOAD_VIDEO_TYPES.

            Returns:
              (url, extension)
            """
            wanted_content = None
            for content in photo_or_video.media.content:
                if content.medium == 'image' and not wanted_content:
                    wanted_content = content
                elif content.type == DOWNLOAD_VIDEO_TYPES[video_format]:
                    wanted_content = content
            if not wanted_content:
                LOG.error('Did not find desired medium!')
                LOG.debug('photo_or_video.media:\n' + photo_or_video.media)
                return None
            elif wanted_content.medium == 'image':
                url = googlecl.picasa.make_download_url(
                    photo_or_video.content.src)
                mimetype = photo_or_video.content.type
                extension = mimetype.split('/')[1]
            else:
                url = wanted_content.url
                extension = video_format
            return (url, extension)
        # End _get_download_info

        if not user:
            user = 'default'
        entries = self.GetAlbum(user=user, titles=titles)
        if DOWNLOAD_VIDEO_TYPES.keys() not in video_format:
            LOG.error('Unsupported video format: ' + video_format)
            LOG.info('Try one of the following video formats: ' +
                     str(DOWNLOAD_VIDEO_TYPES.keys())[1:-1])
            video_format = 'mp4'
            LOG.info('Downloading videos as ' + video_format)

        for album in entries:
            album_path = os.path.join(base_path, safe_decode(album.title.text))
            album_concat = 1
            if os.path.exists(album_path):
                base_album_path = album_path
                while os.path.exists(album_path):
                    album_path = base_album_path + '-%i' % album_concat
                    album_concat += 1
            os.makedirs(album_path)

            uri = ('/data/feed/api/user/%s/albumid/%s?kind=photo' %
                   (user, album.gphoto_id.text))
            photo_entries = self.GetEntries(uri, photo_title)

            for photo_or_video in photo_entries:
                # TODO: Test on Windows (upload from one OS, download from
                # another)
                photo_or_video_name = safe_decode(photo_or_video.title.text)
                photo_or_video_name = photo_or_video_name.split(os.extsep)[0]
                url, extension = _get_download_info(
                    photo_or_video, video_format)
                path = os.path.join(album_path,
                                    photo_or_video_name + os.extsep + extension)
                # Check for a file extension, add it if it does not exist.
                if os.path.exists(path):
                    base_path = path
                    photo_concat = 1
                    while os.path.exists(path):
                        path = base_path + '-%i' % photo_concat
                        photo_concat += 1
                LOG.info(safe_encode('Downloading %s to %s' %
                                     (safe_decode(photo_or_video.title.text), path)))
                urllib.urlretrieve(url, path)
dataset/ETHPy150Open vinitkumar/googlecl/src/googlecl/picasa/service.py/PhotosServiceCL.download_album/swapped operands of `not in`