def getList(user_id=USER_ID, page=None, per_page=None, **params):
        """
        Get list of photosets. Allow paginator
        :param user_id:
            The NSID of the user to get a photoset list for.
            If none is specified, the calling user is assumed.
        :param page:
            The page of results to return. If this argument is omitted, it
            defaults to 1.
        :param per_page:
            Number of photos to return per page. If this argument is
            omitted, it defaults to 500. The maximum allowed value is 500.
        :param params:
            Extra params to request in flickr api.
        :return: object_list, paginator and page_obj
        """
        flickr = FlickrAPI.construct()

        try:
            params.update({
                'user_id': user_id,
                'format': 'json',
                'per_page': per_page,
                'page': page or 1
            })

            response = flickr.photosets.getList(**params)

            if isinstance(response, (str, bytes)):
                response = flickr.parse_json(response)

            def parse_reponse(response):
                _photosets = response.get('photosets', None)

                if not _photosets:
                    return [None, None, None, None, None]

                return (_photosets['photoset'], _photosets['total'],
                        _photosets['page'], _photosets['perpage'],
                        _photosets['pages'])

            photosets, total, page, per_page, pages = parse_reponse(response)
            photosets = [
                Photoset(id=photoset['id'], data=photoset)
                for photoset in photosets
            ]
            paginator, page_obj = None, None

            if per_page is not None:
                paginator, page_obj = get_paginator(photosets,
                                                    page=page,
                                                    per_page=per_page,
                                                    pages=pages,
                                                    total=total)

            return photosets, paginator, page_obj

        except FlickrError as e:
            if e.code == 1:
                raise Http404(_("Photosets not found."))
    def getList(user_id=USER_ID, page=None, per_page=None, **params):
        """
        Get list of photosets. Allow paginator
        :param user_id:
            The NSID of the user to get a photoset list for.
            If none is specified, the calling user is assumed.
        :param page:
            The page of results to return. If this argument is omitted, it
            defaults to 1.
        :param per_page:
            Number of photos to return per page. If this argument is
            omitted, it defaults to 500. The maximum allowed value is 500.
        :param params:
            Extra params to request in flickr api.
        :return: object_list, paginator and page_obj
        """
        flickr = FlickrAPI.construct()

        try:
            params.update({
                'user_id': user_id,
                'format': 'json',
                'per_page': per_page,
                'page': page or 1
            })

            response = flickr.photosets.getList(**params)

            if isinstance(response, (str, bytes)):
                response = flickr.parse_json(response)

            def parse_reponse(response):
                _photosets = response.get('photosets', None)

                if not _photosets:
                    return [None, None, None, None, None]

                return (
                    _photosets['photoset'],
                    _photosets['total'],
                    _photosets['page'],
                    _photosets['perpage'],
                    _photosets['pages']
                )

            photosets, total, page, per_page, pages = parse_reponse(response)
            photosets = [Photoset(id=photoset['id'], data=photoset) for photoset in photosets]
            paginator, page_obj = None, None

            if per_page is not None:
                paginator, page_obj = get_paginator(
                    photosets, page=page, per_page=per_page,
                    pages=pages, total=total)

            return photosets, paginator, page_obj

        except FlickrError as e:
            if e.code == 1:
                raise Http404(_("Photosets not found."))
    def getPhotos(self, user_id=USER_ID, page=None, per_page=None, privacy_filter=1, **params):
        """
        Get photos from flickr photosets. Allow paginator.
        :param user_id:
            The user_id here is the owner of the set passed in photoset_id.
            This is optional, but passing this gives better performance.
        :param page:
            The page of results to return. If this argument is omitted, it
            defaults to 1.
        :param per_page:
            Number of photos to return per page. If this argument is
            omitted, it defaults to 500. The maximum allowed value is 500.
        :param privacy_filter:
            Return photos only matching a certain privacy level. This only
            applies when making an authenticated call to view a photoset
            you own. Valid values are:

            1 public photos
            2 private photos visible to friends
            3 private photos visible to family
            4 private photos visible to friends & family
            5 completely private photos
        :param params:
            Extra params to request in flickr api.
        :return: object_list, paginator and page_obj
        """
        flickr = FlickrAPI.construct()

        try:
            params.update({
                'photoset_id': self.id,
                'user_id': user_id,
                'format': 'json',
                'per_page': per_page,
                'page': page or 1,
                'privacy_filter': privacy_filter,
                'media': 'photos',
                'extras': 'description'
            })

            response = flickr.photosets.getPhotos(**params)

            if isinstance(response, (str, bytes)):
                response = flickr.parse_json(response)

            def parse_reponse(response):
                _photoset = response.get('photoset', None)

                if not _photoset:
                    return [None, None, None, None, None]

                return [
                    _photoset['photo'],
                    _photoset['total'],
                    _photoset['page'],
                    _photoset['perpage'],
                    _photoset['pages']
                ]

            photos, total, page, per_page, pages = parse_reponse(response)
            paginator, page_obj = None, None

            if photos is not None:
                photos = [Photo(photo['id'], data=photo) for photo in photos]

            if per_page is not None:
                paginator, page_obj = get_paginator(
                    photos, page=page, per_page=per_page,
                    pages=pages, total=total)

            return photos, paginator, page_obj
        except FlickrError as e:
            if e.code == 1:
                raise Http404(_("Photoset %s not found.") % self.id)
    def getPhotos(self,
                  user_id=USER_ID,
                  page=None,
                  per_page=None,
                  privacy_filter=1,
                  **params):
        """
        Get photos from flickr photosets. Allow paginator.
        :param user_id:
            The user_id here is the owner of the set passed in photoset_id.
            This is optional, but passing this gives better performance.
        :param page:
            The page of results to return. If this argument is omitted, it
            defaults to 1.
        :param per_page:
            Number of photos to return per page. If this argument is
            omitted, it defaults to 500. The maximum allowed value is 500.
        :param privacy_filter:
            Return photos only matching a certain privacy level. This only
            applies when making an authenticated call to view a photoset
            you own. Valid values are:

            1 public photos
            2 private photos visible to friends
            3 private photos visible to family
            4 private photos visible to friends & family
            5 completely private photos
        :param params:
            Extra params to request in flickr api.
        :return: object_list, paginator and page_obj
        """
        flickr = FlickrAPI.construct()

        try:
            params.update({
                'photoset_id': self.id,
                'user_id': user_id,
                'format': 'json',
                'per_page': per_page,
                'page': page or 1,
                'privacy_filter': privacy_filter,
                'media': 'photos',
                'extras': 'description'
            })

            response = flickr.photosets.getPhotos(**params)

            if isinstance(response, (str, bytes)):
                response = flickr.parse_json(response)

            def parse_reponse(response):
                _photoset = response.get('photoset', None)

                if not _photoset:
                    return [None, None, None, None, None]

                return [
                    _photoset['photo'], _photoset['total'], _photoset['page'],
                    _photoset['perpage'], _photoset['pages']
                ]

            photos, total, page, per_page, pages = parse_reponse(response)
            paginator, page_obj = None, None

            if photos is not None:
                photos = [Photo(photo['id'], data=photo) for photo in photos]

            if per_page is not None:
                paginator, page_obj = get_paginator(photos,
                                                    page=page,
                                                    per_page=per_page,
                                                    pages=pages,
                                                    total=total)

            return photos, paginator, page_obj
        except FlickrError as e:
            if e.code == 1:
                raise Http404(_("Photoset %s not found.") % self.id)