'Returns info for a particular user via a case insensitive search'

def find_users(self, username_pattern, search_attr=None, user_name_attr=None, find_by_dn=False, scope=ldap.SCOPE_SUBTREE):

    if find_by_dn:
        data = filter((lambda attrs: (attrs['dn'] == username_pattern)), self._instance.users.values())
    else:
        username_pattern = ('^%s$' % username_pattern.replace('.', '\\.').replace('*', '.*'))
        username_fsm = re.compile(username_pattern, flags=re.I)
        usernames = filter((lambda username: username_fsm.match(username)), self._instance.users.keys())
        data = [self._instance.users.get(username) for username in usernames]
    return data
