human
Complete the below
@gen.coroutine
def UploadEpisode(client, obj_store, user_id, device_id, request):

    ''''Creates metadata for new photos and returns URLs where the client
    should upload the photo images. Creates a new episode to group the
    photos or adds the photos to an existing episode.'
    '''

Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.
    def _GenerateUploadUrl(obj_store, ph_dict, suffix, md5_attr):
        'Create    an    S3    URL    that    is    the    target    of    a    photo    upload.    "suffix"    is\n                appended    to    the    end    of    the    photo    id    in    order    to    distinguish    different\n                photo    sizes.    The    value    of    the    "md5_attr"    attribute    is    converted    to    a\n                base-64    encoded    value    for    the    HTTP    Content-MD5    header.    Using    this\n                attribute    ensures    that    the    user    uploads    a    photo    that    exactly    matches\n                the    MD5,    and    also    enables    detection    of    any    bit    corruption    on    the    wire.\n                '
        md5_hex = ph_dict[md5_attr]
        try:
            content_md5 = base64.b64encode(md5_hex.decode('hex'))
        except TypeError:
            raise InvalidRequestError(('md5    value    "%s"    is    invalid;    it    must    be    in    ascii    hex    format' % md5_hex))
        return obj_store.GenerateUploadUrl(('%s%s' % (ph_dict['photo_id'], suffix)), content_type=ph_dict.get('content_type', 'image/jpeg'), content_md5=content_md5)
    @gen.coroutine
    def _VerifyAttributeUpdate(photo, suffix, attr_name, new_value):
        "Checks    whether    the    specified    photo    metadata    attribute    is    about\n                to    be    modified.    Don't    allow    the    change    if    the    photo    image    data    has\n                already    been    uploaded    to    S3.    This    check    prevents    situations    where\n                photo    MD5    values    are    updated    after    the    initial    upload,    which    could\n                allow    a    user    to    overwrite    an    existing    photo    in    order    to    bypass    the\n                7-day    unshare    rule.    But    it    still    allows    cases    where    a    new    MD5    was\n                generated    by  ...