'Handle HTTP DELETE requests for the Swift Object Server.'

@public
@timing_stats()
def DELETE(self, request):

    (device, partition, account, container, obj, policy) = get_name_and_placement(request, 5, 5, True)
    req_timestamp = valid_timestamp(request)
    next_part_power = request.headers.get('X-Backend-Next-Part-Power')
    try:
        disk_file = self.get_diskfile(device, partition, account, container, obj, policy=policy, next_part_power=next_part_power)
    except DiskFileDeviceUnavailable:
        return HTTPInsufficientStorage(drive=device, request=request)
    try:
        orig_metadata = disk_file.read_metadata()
    except DiskFileXattrNotSupported:
        return HTTPInsufficientStorage(drive=device, request=request)
    except DiskFileExpired as e:
        orig_timestamp = e.timestamp
        orig_metadata = e.metadata
        response_class = HTTPNotFound
    except DiskFileDeleted as e:
        orig_timestamp = e.timestamp
        orig_metadata = {}
        response_class = HTTPNotFound
    except (DiskFileNotExist, DiskFileQuarantined):
        orig_timestamp = 0
        orig_metadata = {}
        response_class = HTTPNotFound
    else:
        orig_timestamp = disk_file.data_timestamp
        if (orig_timestamp < req_timestamp):
            response_class = HTTPNoContent
        else:
            response_class = HTTPConflict
    response_timestamp = max(orig_timestamp, req_timestamp)
    orig_delete_at = int((orig_metadata.get('X-Delete-At') or 0))
    try:
        req_if_delete_at_val = request.headers['x-if-delete-at']
        req_if_delete_at = int(req_if_delete_at_val)
    except KeyError:
        pass
    except ValueError:
        return HTTPBadRequest(request=request, body='Bad    X-If-Delete-At    header    value')
    else:
        if (not orig_timestamp):
            return HTTPNotFound()
        if (orig_delete_at != req_if_delete_at):
            return HTTPPreconditionFailed(request=request, body='X-If-Delete-At    and    X-Delete-At    do    not    match')
        else:
            response_class = HTTPNoContent
    if orig_delete_at:
        self.delete_at_update('DELETE', orig_delete_at, account, container, obj, request, device, policy)
    if (orig_timestamp < req_timestamp):
        try:
            disk_file.delete(req_timestamp)
        except DiskFileNoSpace:
            return HTTPInsufficientStorage(drive=device, request=request)
        self.container_update('DELETE', account, container, obj, request, HeaderKeyDict({'x-timestamp': req_timestamp.internal}), device, policy)
    return response_class(request=request, headers={'X-Backend-Timestamp': response_timestamp.internal})
