'Get mime-type and PIL format by file extension.'

def getTypeByExtension(self, extension):

    if hasattr(self.provider, 'getTypeByExtension'):
        return self.provider.getTypeByExtension(extension)
    elif (extension.lower() == 'png'):
        return ('image/png', 'PNG')
    elif (extension.lower() == 'jpg'):
        return ('image/jpeg', 'JPEG')
    else:
        raise KnownUnknown(('Unknown    extension    in    configuration:    "%s"' % extension))
