from typing import Callable
from typing import Any


def to_string_gen(gen) -> Callable[[Any], str]:
    """
    Accepts a string or a function that returns a string and returns a function that returns a string

    :param gen: either the string to be returned or a generator that accepts an element and returns a string
    :return:  a string generator that accepts an element

    >>> s_gen = to_string_gen("some_constant")
    >>> s_gen(1)
    'some_constant'
    >>> s_gen("hello")
    'some_constant'
    >>> echo_gen = to_string_gen( lambda x: str(x))
    >>> echo_gen(1)
    '1'
    >>> echo_gen("hello")
    'hello'
    """
    if gen is None:
        return lambda x: ""
    if isinstance(gen, str):
        return lambda x: gen
    else:
        return gen