<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_sampler(sample_mode: str):
 """Return a sampler constructor <class 'cr8.metrics.All'> <class 'cr8.metrics.UniformReservoir'> functools.partial(<class 'cr8.metrics.UniformReservoir'>, size=100) """

    if sample_mode == 'all':
        return All
    mode = sample_mode.split(':')
    if mode[0] == 'reservoir':
        if len(mode) == 2:
            return partial(UniformReservoir, size=int(mode[1]))
        else:
            return UniformReservoir
    raise TypeError(f'Invalid sample_mode: {sample_mode}')