def _get_output_format(self, output):
    '\n        Given an output object, attempt to determine the requested format.\n\n        We attempt to determine the filename of the *output* object and derive\n        a MIME type from the extension. If *output* has no filename, an error\n        is raised.\n        '
    if isinstance(output, bytes):
        filename = output.decode('utf-8')
    elif isinstance(output, str):
        filename = output
    else:
        try:
            filename = output.name
        except AttributeError:
            raise PiCameraValueError('Format must be specified when output has no filename')
    (type, encoding) = mimetypes.guess_type(filename, strict=False)
    if (not type):
        raise PiCameraValueError(('Unable to determine type from filename %s' % filename))
    return type
Given an output object, attempt to determine the requested format.

We attempt to determine the filename of the *output* object and derive
a MIME type from the extension. If *output* has no filename, an error
is raised.
def _get_output_format(self, output):
    '\n        Given an output object, attempt to determine the requested format.\n\n        We attempt to determine the filename of the *output* object and derive\n        a MIME type from the extension. If *output* has no filename, an error\n        is raised.\n        '
    if isinstance(output, bytes):
        filename = output.decode('utf-8')
    elif isinstance(output, str):
        filename = output
    else:
        try:
            filename = output.name
        except AttributeError:
            raise PiCameraValueError('Format must be specified when output has no filename')
    (type, encoding) = mimetypes.guess_type(filename, strict=False)
    if (not type):
        raise PiCameraValueError(('Unable to determine type from filename %s' % filename))
    return type