human
Complete the below
def _TestUploadEpisode(tester, user_cookie, request_dict):

    ''''Called by the ServiceTester in order to test upload_episode
    service API call.'
    '''

=====
Write me a the Python program you requested?
assistant
#Here is the Python program you requested.
    validator = tester.validator
    (user_id, device_id) = tester.GetIdsFromCookie(user_cookie)
    request_dict = deepcopy(request_dict)
    def _GenerateUploadUrl(obj_store, photo, suffix, md5_hex):
        'Create    expected    URL    to    which    to    upload    image    data.'
        content_md5 = base64.b64encode(md5_hex.decode('hex'))
        return obj_store.GenerateUploadUrl(('%s%s' % (photo.photo_id, suffix)), content_type=photo.content_type, content_md5=content_md5)
    actual_dict = tester.SendRequest('upload_episode', user_cookie, request_dict)
    ep_dict = request_dict['episode']
    ep_dict['user_id'] = user_id
    ep_dict['viewpoint_id'] = validator.GetModelObject(User, user_id).private_vp_id
    ep_dict['publish_timestamp'] = request_dict['headers']['op_timestamp']
    existing_episode = validator.GetModelObject(Episode, ep_dict['episode_id'], must_exist=False)
    if (existing_episode is not None):
        ep_dict = {'episode_id': ep_dict['episode_id']}
    new_photo_ids = []
    expected_dict = {'photos': []}
    for (ph_dict, actual_ph_dict) in zip(request_dict['photos'], actual_dict['photos']):
        if (('location' not in ep_dict) and ('location' in ph_dict)):
            if ((existing_episode is None) or (existing_episode.location == None)):
                ep_dict['location'] = ph_dict['location']
        if (('placemark' not in ep_dict) and ('placemark' in ph_dict)):
            if ((existing_episode is None) or (existing_episode.placemark == None)):
                ep_dict['placemark'] = ph_dict['placemark']
        asset_keys = ph_dict.pop('asset_keys', None)
        if asset_keys:
            assert user_id
            up_dict = {'user_id': user_id, 'photo_id': ph_dict['photo_id'], 'asset_keys': asset_keys}
            validator.ValidateCreateDBObject(UserPhoto, **up_dict)
        if (validator.GetModelObject(Photo, ph_dict['photo_id'], must_exist=False) is None):
            ph_dict['episode_id'] = ep_dict['episode_id']
        else:
            for key in ph_dict.keys():
...