Execute a on_resolve function once the thenable is resolved,
    returning the same type of object inputed.
    If the object is not thenable, it should return on_resolve(obj)

def maybe_thenable(obj, on_resolve):
    """
    Execute a on_resolve function once the thenable is resolved,
    returning the same type of object inputed.
    If the object is not thenable, it should return on_resolve(obj)
    """
    if isawaitable(obj) and not isinstance(obj, Promise):
        return await_and_execute(obj, on_resolve)

    if is_thenable(obj):
        return Promise.resolve(obj).then(on_resolve)

    # If it's not awaitable not a Promise, return
    # the function executed over the object
    return on_resolve(obj)