<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def video(video_type, video_mime, doc=None):
 """Dynamically creates a video type handler for the specified video type"""

    @on_valid(video_mime)
    def video_handler(data, **kwargs):
        if hasattr(data, 'read'):
            return data
        elif hasattr(data, 'save'):
            output = stream()
            data.save(output, format=video_type.upper())
            output.seek(0)
            return output
        elif hasattr(data, 'render'):
            return data.render()
        elif os.path.isfile(data):
            return open(data, 'rb')

    video_handler.__doc__ = doc or "{0} formatted video".format(video_type)
    return video_handler