def user_in_group(self, username, group_name):
        '''
        Returns :data:`True` if the given user is in the given group, :data:`False` otherwise.

        :param username: Name of the user to verify.
        :type username: :class:`str`
        :param group_name: Name of the group to verify.
        :type group_name: :class:`str`
        :return: Whether the user pertains to the group or not.
        :rtype: :class:`bool`

        Example:
        ::

            from provy.core import Role
            from provy.more.debian import UserRole

            class MySampleRole(Role):
                def provision(self):
                    with self.using(UserRole) as role:
                        if role.user_in_group('myuser', 'mygroup'):
                            pass
        '''
        raw_groups = self.execute('groups %s' % username, sudo=True, stdout=False).strip()
        if not raw_groups.startswith(username):
            raise ValueError(username % "User '%s' doesn't exist")
        groups_string = raw_groups.replace('%s : ' % username, '')
        groups = groups_string.split()
        return group_name in groups
dataset/ETHPy150Open python-provy/provy/provy/more/debian/users/user.py/UserRole.user_in_group/swapped operands of `%`