(generator_or_value)
Dynamic typing hack to try to call generators if provided,
    otherwise return the value directly if not callable. This will
    break badly if used for values that can be callable.
Dynamic typing hack to try to call generators if provided,
    otherwise return the value directly if not callable. This will
    break badly if used for values that can be callable.
Dynamic typing hack to try to call generators if provided otherwise return the value directly if not callable . This will break badly if used for values that can be callable .
def instantiate(generator_or_value):
    """
    Dynamic typing hack to try to call generators if provided,
    otherwise return the value directly if not callable. This will
    break badly if used for values that can be callable.
    """

    if callable(generator_or_value):
        return generator_or_value()
    else:
        return generator_or_value
def instantiate ( generator_or_value ) : if callable ( generator_or_value ) : return generator_or_value ( ) else : return generator_or_value