<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_activity_photos(self, activity_id, size=None, only_instagram=False):
 """ Gets the photos from an activity. http://strava.github.io/api/v3/photos/ :param activity_id: The activity for which to fetch kudos. :type activity_id: int :param size: the requested size of the activity's photos. URLs for the photos will be returned that best match the requested size. If not included, the smallest size is returned :type size: int :param only_instagram: Parameter to preserve legacy behavior of only returning Instagram photos. :type only_instagram: bool :return: An iterator of :class:`stravalib.model.ActivityPhoto` objects. :rtype: :class:`BatchedResultsIterator` """

        params = {}

        if not only_instagram:
            params['photo_sources'] = 'true'

        if size is not None:
            params['size'] = size

        result_fetcher = functools.partial(self.protocol.get,
                                           '/activities/{id}/photos',
                                           id=activity_id, **params)

        return BatchedResultsIterator(entity=model.ActivityPhoto,
                                      bind_client=self,
                                      result_fetcher=result_fetcher)