def METHOD_NAME(view=None, ids=False):
    """Get group elements in given view"""
    if view:
        cl = DB.FilteredElementCollector(revit.doc, view.Id)
    else:
        cl = DB.FilteredElementCollector(revit.doc)
    elements = cl.OfClass(DB.Group).WhereElementIsNotElementType()
    if ids:
        return elements.ToElementIds()
    else:
        return elements.ToElements()