```python:inference/core/workflows/core_steps/common/query_language/operations/sequences/base.py
from inference.core.workflows.core_steps.common.query_language.errors import InvalidInputTypeError
from typing import Any, List

def sequence_apply(
    value: Any, fun: callable, execution_context: str, **kwargs
) -> List[Any]:
    try:
        if kwargs:
            return [fun(v, **kwargs) for v in value]
        else:
            return [fun(v) for v in value]
    except (TypeError, ValueError) as e:
        raise InvalidInputTypeError(
            public_message=f"While executing sequence_apply(...) in context {execution_context}, encountered "
            f"value of type {type(value)} which is not a sequence to be iterated",
            context=f"step_execution | roboflow_query_language_evaluation | {execution_context}",
            inner_error=e,
        )
```