async def METHOD_NAME(
    self, data: CreateGroupRequest
) -> Union[r201[CreateGroupResponse], r400]:
    """
    Create a group.
    Creates a new group with the given name.
    The ``group_id`` parameter is deprecated and will no longer be accepted in a
    future major release. For now, ``group_id`` will be used as ``name`` if it is
    provided.
    Status Codes:
        201: Successful operation
        400: Group already exists
    """
    name = data.name
    try:
        group = await get_data_from_req(self.request).groups.create(name)
    except ResourceConflictError:
        raise HTTPBadRequest(text="Group already exists")
    return json_response(
        GroupResponse.parse_obj(group),
        status=201,
        headers={"Location": f"/groups/{group.id}"},
    )