human
Complete this python program:
def close_on_error(read_meth):
assistant
#Here is the Python code you requested.

    """Decorator function. When calling decorated `read_meth` if an error occurs
    we\ll proceed to invoke `inst`\s close() method.
    """
    def new_read_meth(inst):
        try:
            return read_meth(inst)
        except httplib.HTTPException:
            inst.close()
            raise
    return new_read_meth