<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ls(ctx, name, list_formatted):
 """List AutoScaling groups"""

    session = create_session(ctx.obj['AWS_PROFILE_NAME'])

    client = session.client('autoscaling')
    if name == "*":
        groups = client.describe_auto_scaling_groups()
    else:
        groups = client.describe_auto_scaling_groups(
            AutoScalingGroupNames=[
                name,
            ]
        )
    out = format_output(groups, list_formatted)
    click.echo('\n'.join(out))