compat: get_master() routine
ipdb: cleanup device from possible masters

FIXME: a postponed issue, this code can and must be optimized