@staticmethod
def _locate_entry(entries, key):
    """ Search the binary tree structure for the correct entry.

        :param key: the key to search the master pop table for a given entry
        :return: the entry for this given key
        :rtype: :py:class:`_MasterPopEntry`
        """
    imin = 0
    imax = len(entries)
    while imin < imax:
        imid = (imax + imin) // 2
        entry = entries[imid]
        if key & entry['mask'] == entry['key']:
            return entry
        if key > entry['key']:
            imin = imid + 1
        else:
            imax = imid
    return None
