def rel_to_abs_tuple(target: tuple, namespace: tuple):
    """Convert name relative to namespace to absolute"""
    ns = namespace
    nslen = len(ns)
    dots = 0
    while dots < len(target) and target[dots] == '.':
        dots += 1
    if target[0] == '.' * len(target[0]):
        dots = len(target[0])
    else:
        raise ValueError('invalid tuple')
    shared = nslen - dots + 1
    tg = target[1:]
    abs = ns[:shared] + tg
    return abs
