def METHOD_NAME(request, name):
    """Do the checks and return a usergroup object from the name"""
    # Only GET data are handled
    if request.method != "GET":
        return False
    # Check for required fields
    if not name:
        return False
    # Check if the name exists in the database
    query = db.session.query(usergroup.Usergroup).filter_by(
        name=name).first()
    return query