def _strip_magic_tail(path):
    """    some.path___with_.__magics__ --> some.path """
    pa_th = path.split('.')
    while pa_th[-1].startswith('__'):
        del pa_th[-1]
        if not pa_th:
            return []
    path = '.'.join(pa_th)
    return path[:-2] if path.endswith('()') else path
