Similar to :meth:`get_input_peer`, but for chat photos

def get_input_chat_photo(photo):
    """Similar to :meth:`get_input_peer`, but for chat photos"""
    try:
        if photo.SUBCLASS_OF_ID == 0xd4eb2d74:  # crc32(b'InputChatPhoto')
            return photo
        elif photo.SUBCLASS_OF_ID == 0xe7655f1f:  # crc32(b'InputFile'):
            return types.InputChatUploadedPhoto(photo)
    except AttributeError:
        _raise_cast_fail(photo, 'InputChatPhoto')

    photo = get_input_photo(photo)
    if isinstance(photo, types.InputPhoto):
        return types.InputChatPhoto(photo)
    elif isinstance(photo, types.InputPhotoEmpty):
        return types.InputChatPhotoEmpty()

    _raise_cast_fail(photo, 'InputChatPhoto')