Generates a unix command line for creating user and group with the same name, assigning the user to the group.
    Has the same effect as combining :func:`~addgroup`, :func:`~adduser`, and :func:`~assignuser`.

    :param username: User name to create.
    :type username: unicode | str
    :param uid: User id to use.
    :type uid: int
    :param groupnames: Iterable with additional group names to assign the user to.
    :type groupnames: collections.Iterable[unicode | str]
    :param system: Create a system user and group. Default is ``False``.
    :type system: bool
    :param no_login: Disallow login of this user and group, and skip creating the home directory. Default is ``True``.
    :type no_login: bool
    :param no_password: Do not set a password for the new user.
    :type: no_password: bool
    :param gecos: Provide GECOS info and suppress prompt.
    :type gecos: unicode | str
    :param sudo: Prepend `sudo` to the command. Default is ``False``. When using Fabric, use its `sudo` command instead.
    :type sudo: bool
    :param kwargs: Additional keyword arguments for command line arguments.
    :return: Unix shell command line.
    :rtype: unicode | str

def addgroupuser(username, uid, groupnames=None, system=False, no_login=True, no_password=False, gecos=None, sudo=False,
                 **kwargs):
    """
    Generates a unix command line for creating user and group with the same name, assigning the user to the group.
    Has the same effect as combining :func:`~addgroup`, :func:`~adduser`, and :func:`~assignuser`.

    :param username: User name to create.
    :type username: unicode | str
    :param uid: User id to use.
    :type uid: int
    :param groupnames: Iterable with additional group names to assign the user to.
    :type groupnames: collections.Iterable[unicode | str]
    :param system: Create a system user and group. Default is ``False``.
    :type system: bool
    :param no_login: Disallow login of this user and group, and skip creating the home directory. Default is ``True``.
    :type no_login: bool
    :param no_password: Do not set a password for the new user.
    :type: no_password: bool
    :param gecos: Provide GECOS info and suppress prompt.
    :type gecos: unicode | str
    :param sudo: Prepend `sudo` to the command. Default is ``False``. When using Fabric, use its `sudo` command instead.
    :type sudo: bool
    :param kwargs: Additional keyword arguments for command line arguments.
    :return: Unix shell command line.
    :rtype: unicode | str
    """
    group = addgroup(username, uid, system)
    user = adduser(username, uid, system, no_login, no_password, False, gecos, **kwargs)
    prefix = 'sudo ' if sudo else ''
    if groupnames:
        usermod = assignuser(username, groupnames)
        return '{0}{1} && {0}{2} && {0}{3}'.format(prefix, group, user, usermod)
    return '{0}{1} && {0}{2}'.format(prefix, group, user)