How to create a decorator like TypeDispatch for matching different return types?

TypeDispatch allow us to match different functions depending on the arguments passed:


@fc.typedispatch

def fn(x:int): return x+1

@fc.typedispatch

def fn(x:float): return x+2

fn(1), fn(1.0)
>  (2,3)

Is it possible to create a decorator like TypeDispatch that matches the function depending on the number of returned values?

Something like…

@returndispatch
def fn(x) -> tuple: return 1,1

@returndispatch
def fn(x) -> int: return 5

a,b = fn(x)
a,b
>  1,1