def normalize_query_param(value):
    """
    Given a non-flattened query parameter value,
    and if the value is a list only containing 1 item,
    then the value is flattened.

    :param value: a value from a query parameter
    :return: a normalized query parameter value
    """

    if len(value) == 1 and value[0].lower() in ["true", "false"]:

        if value[0].lower() == "true":
            return True
        return False

    return value if len(value) > 1 else value[0]