def transform_parameter_value(parameter_name, value, parameter_config):
if isinstance(value, list):<EOL><INDENT>return [transform_parameter_value('<STR_LIT>' % (parameter_name, index),<EOL>element, parameter_config)<EOL>for index, element in enumerate(value)]<EOL><DEDENT>entry = _get_parameter_conversion_entry(parameter_config)<EOL>if entry:<EOL><INDENT>validation_func, conversion_func, type_name = entry<EOL>if validation_func:<EOL><INDENT>validation_func(parameter_name, value, parameter_config)<EOL><DEDENT>if conversion_func:<EOL><INDENT>try:<EOL><INDENT>return conversion_func(value)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise errors.BasicTypeParameterError(parameter_name, value, type_name)<EOL><DEDENT><DEDENT><DEDENT>return value<EOL>
Validates and transforms parameters to the type expected by the API.

    If the value is a list this will recursively call _transform_parameter_value
    on the values in the list. Otherwise, it checks all parameter rules for the
    the current value and converts its type from a string to whatever format
    the API expects.

    In the list case, '[index-of-value]' is appended to the parameter name for
    error reporting purposes.

    Args:
      parameter_name: A string containing the name of the parameter, which is
        either just a variable name or the name with the index appended, in the
        recursive case. For example 'var' or 'var[2]'.
      value: A string or list of strings containing the value(s) passed in for
        the parameter.  These are the values from the request, to be validated,
        transformed, and passed along to the backend.
      parameter_config: The dictionary containing information specific to the
        parameter in question. This is retrieved from request.parameters in the
        method config.

    Returns:
      The converted parameter value(s).  Not all types are converted, so this
      may be the same string that's passed in.