from typing import Any
from typing import MutableSequence


def ensure_list(value: Any, convert_csv: bool = False, delimiter: str = ',') -> MutableSequence[Any]:
    """Convert an object, response, or (optionally) comma-separated string into a list"""
    if not value:
        return []
    elif isinstance(value, dict) and 'results' in value:
        value = value['results']
    elif convert_csv and isinstance(value, str) and delimiter in value:
        return [s.strip() for s in value.split(delimiter)]

    if isinstance(value, MutableSequence):
        return value
    elif isinstance(value, (tuple, set)):
        return list(value)
    else:
        return [value]