human
Complete this python program:
def _TestQueryFollowed(tester, user_cookie, request_dict):
assistant
#Here is the Python code you requested.

    """Called by the ServiceTester in order to test query_followed
    service API call.
    """
    validator = tester.validator
    (user_id, device_id) = tester.GetIdsFromCookie(user_cookie)
    def _MakeViewpointDict(followed):
        'Create    a    viewpoint    dict    from    the    followed    object    plus    its\n                referenced    viewpoint    object.\n                '
        viewpoint = validator.GetModelObject(Viewpoint, followed.viewpoint_id)
        follower = validator.GetModelObject(Follower, DBKey(followed.user_id, followed.viewpoint_id))
        metadata_dict = viewpoint.MakeMetadataDict(follower)
        if (follower.CanViewContent() and ('cover_photo' in metadata_dict)):
            photo_dict = metadata_dict['cover_photo']
            obj_store = ObjectStore.GetInstance(ObjectStore.PHOTO)
            _AddPhotoUrls(obj_store, photo_dict)
        return metadata_dict
    actual_dict = tester.SendRequest('query_followed', user_cookie, request_dict)
    followed = validator.QueryModelObjects(Followed, user_id, limit=request_dict.get('limit', None), start_key=request_dict.get('start_key', None))
    expected_dict = {'viewpoints': [_MakeViewpointDict(f) for f in followed]}
    if (len(followed) > 0):
        expected_dict['last_key'] = followed[(-1)].sort_key
    tester._CompareResponseDicts('query_followed', user_id, request_dict, expected_dict, actual_dict)
    return actual_dict