human
Complete this python program:
def handle_conflicts(type='object'):
assistant
#Here is the Python code you requested.

    """Converts IntegrityError into HTTP 409 Conflict.
    """
    def decorator(method):
        @functools.wraps(method)
        def wrapper(*args, **kwargs):
            try:
                return method(*args, **kwargs)
            except IntegrityError as e:
                raise exception.Conflict(type=type, details=str(e.orig))
        return wrapper
    return decorator