from typing import Union


def escape(strings: Union[str, list]) -> Union[str, list]:
    """Escape markdown special characters

    Args:
        strings: an input to process

    Return:
        A processed input.

    Raises:
        ValueError: If the input is not `str` nor `list`.
    """
    if isinstance(strings, str):
        return strings.replace('_', '\\_')
    if isinstance(strings, list):
        return [escape(el) for el in strings]
    raise ValueError('Unsupported type in escape(): ' + type(strings))