def ogr_geom(value):
    """Returns an ``ogr.Geometry`` instance from the given value.

    Raises a ``ValueError`` if no geometry can be created from the given value.

    This function accepts values in the following formats:

    * (x, y) (2-uple of integers),
    * WKT,
    * GeoJSON.

    """
    from osgeo import ogr
    ogr.UseExceptions()
    if isinstance(value, (tuple, list)):
        x, y = value
        geom = ogr.Geometry(ogr.wkbPoint)
        geom.SetCoordinateDimension(2)
        geom.AddPoint_2D(x, y)
        return geom
    for geom_function in [ogr.CreateGeometryFromWkt, ogr.CreateGeometryFromJson
        ]:
        try:
            return geom_function(value)
        except RuntimeError:
            pass
    raise ValueError('Invalid value for Geometry: {}'.format(value))
