# turn foo.bar -> ['foo', 'bar'] def _parent_name(target): r = target.rsplit('.', 1) if len(r) == 1: return '', r[0] else: return r[0], r[1]