human
Complete the below
def createMethod(methodName, methodDesc, rootDesc, schema):

    ''''Creates a method for attaching to a Resource.
    Args:
    methodName: string, name of the method to use.
    methodDesc: object, fragment of deserialized discovery document that
    describes the method.
    rootDesc: object, the entire deserialized discovery document.
    schema: object, mapping of schema names to schema descriptions.'
    '''

=====
Write me a the Python code you requested?
assistant
#Here is the Python code you requested.
    methodName = fix_method_name(methodName)
    (pathUrl, httpMethod, methodId, accept, maxSize, mediaPathUrl) = _fix_up_method_description(methodDesc, rootDesc)
    parameters = ResourceMethodParameters(methodDesc)
    def method(self, **kwargs):
        for name in six.iterkeys(kwargs):
            if (name not in parameters.argmap):
                raise TypeError(('Got    an    unexpected    keyword    argument    "%s"' % name))
        keys = list(kwargs.keys())
        for name in keys:
            if (kwargs[name] is None):
                del kwargs[name]
        for name in parameters.required_params:
            if (name not in kwargs):
                if ((name not in _PAGE_TOKEN_NAMES) or _findPageTokenName(_methodProperties(methodDesc, schema, 'response'))):
                    raise TypeError(('Missing    required    parameter    "%s"' % name))
        for (name, regex) in six.iteritems(parameters.pattern_params):
            if (name in kwargs):
                if isinstance(kwargs[name], six.string_types):
                    pvalues = [kwargs[name]]
                else:
                    pvalues = kwargs[name]
                for pvalue in pvalues:
                    if (re.match(regex, pvalue) is None):
                        raise TypeError(('Parameter    "%s"    value    "%s"    does    not    match    the    pattern    "%s"' % (name, pvalue, regex)))
        for (name, enums) in six.iteritems(parameters.enum_params):
            if (name in kwargs):
                if ((name in parameters.repeated_params) and (not isinstance(kwargs[name], six.string_types))):
                    values = kwargs[name]
                else:
                    values = [kwargs[name]]
                for value in values:
                    if (value not in enums):
                        raise TypeError(('Parameter    "%s"    value    "%s"    is    not    an    allowed    value    in    "%s"' % (name, value, str(enums))))
        actual_query_params = {}
        actual_path_params = {}
        for...