def CreateGroup(r, name, alloc_policy=None, dry_run=False):
    """
    Creates a new node group.

    @type name: str
    @param name: the name of node group to create
    @type alloc_policy: str
    @param alloc_policy: the desired allocation policy for the group, if any
    @type dry_run: bool
    @param dry_run: whether to peform a dry run

    @rtype: int
    @return: job id
    """
    query = {'dry-run': dry_run}
    body = {'name': name, 'alloc_policy': alloc_policy}
    return r.request('post', '/2/groups', query=query, content=body)
