<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_api_headers(param, value):
 """Validate that API headers is a CSV of k=v pairs."""

    # pylint: disable=unused-argument
    if not value:
        return None

    headers = {}
    for kv in value.split(","):
        try:
            k, v = kv.split("=", 1)
            k = k.strip()

            for bad_header in BAD_API_HEADERS:
                if bad_header == k:
                    raise click.BadParameter(
                        "%(key)s is not an allowed header" % {"key": bad_header},
                        param=param,
                    )

            if k in API_HEADER_TRANSFORMS:
                transform_func = API_HEADER_TRANSFORMS[k]
                v = transform_func(param, v)
        except ValueError:
            raise click.BadParameter(
                "Values need to be a CSV of key=value pairs", param=param
            )

        headers[k] = v

    return headers