def METHOD_NAME(sample):
    """
    This function exists because of a change in behaviour of pygobject 3.13 that
    broke our ability to get a writable buffer from a GstSample.
    See https://bugzilla.gnome.org/show_bug.cgi?id=736896 for more information.
    """
    if not isinstance(sample, Gst.Sample):
        raise TypeError("sample_borrow_buffer must take a Gst.Sample.  "
                        "Received a %s instead" % str(type(sample)))
    # hashing a GObject actually gives the address (pointer) of the C struct
    # that backs it!:
    pbuffer = _libgst.gst_sample_get_buffer(hash(sample))
    if pbuffer is None:
        raise ValueError(
            "sample_borrow_buffer: Provided GstSample doesn't contain a buffer")
    yield pbuffer