def METHOD_NAME(self, data):
    # http://en.wikipedia.org/wiki/List_of_file_signatures
    if data.startswith(b"\xff\xd8\xff"):
        return (b"image/jpeg", data)
    if data.startswith(b"\x89PNG"):
        return (b"image/png", data)
    if data.startswith(b"GIF8"):
        return (b"image/gif", data)
    # ignore unknown image format
    return None