'Set a method handler for this request
@param method: the method name
@param handler: the handler function
@type handler: handler(S3Request, **attr)
@param http: restrict to these HTTP methods, list|tuple
@param representation: register handler for non-transformable data
formats
@param transform: register handler for transformable data formats
(overrides representation)'

def set_handler(self, method, handler, http=None, representation=None, transform=False):

    if (http is None):
        http = HTTP_METHODS
    elif (not isinstance(http, (tuple, list))):
        http = (http,)
    if transform:
        representation = ('__transform__',)
    elif (not representation):
        representation = (self.DEFAULT_REPRESENTATION,)
    elif (not isinstance(representation, (tuple, list))):
        representation = (representation,)
    if (not isinstance(method, (tuple, list))):
        method = (method,)
    handlers = self._handlers
    for h in http:
        if (h not in HTTP_METHODS):
            continue
        format_hooks = handlers.get(h)
        if (format_hooks is None):
            format_hooks = handlers[h] = {}
        for r in representation:
            method_hooks = format_hooks.get(r)
            if (method_hooks is None):
                method_hooks = format_hooks[r] = {}
            for m in method:
                method_hooks[m] = handler
