def open_image(image_path):
    """Open an image file in PIL, return the Image object.
       Return None if PIL doesn't recognize the file type.
    """
    try:
        im = Image.open(image_path)
    except __HOLE__, e:
        if str(e) == "cannot identify image file":
            return None
        else:
            raise
    except:
        m = "caught exception identifying '%s', assuming non-image:\n%s"
        e = traceback.format_exc()
        warn(m, image_path, e)
        return None
    return im
dataset/ETHPy150Open mikeorr/WebHelpers2/unfinished/multimedia.py/open_image