def find_asgs(conn, module, name=None, tags=None):
 try:
  asgs_paginator = conn.get_paginator('describe_auto_scaling_groups')
  asgs = asgs_paginator.paginate().build_full_result()
 except ClientError as e:
  module.fail_json(msg=e.message, **camel_dict_to_snake_dict(e.response))
 matched_asgs = []
 if (name is not None):
  name_prog = re.compile(('^' + name))
 for asg in asgs['AutoScalingGroups']:
  if name:
   matched_name = name_prog.search(asg['AutoScalingGroupName'])
  else:
   matched_name = True
  if tags:
   matched_tags = match_asg_tags(tags, asg)
  else:
   matched_tags = True
  if (matched_name and matched_tags):
   matched_asgs.append(camel_dict_to_snake_dict(asg))
 return matched_asgs

def find_asgs ( conn , module , name = None , tags = None ) : try : asgs_paginator = conn . get_paginator ( 'describe_auto_scaling_groups' ) asgs = asgs_paginator . paginate ( ) . build_full_result ( ) except ClientError as e : module . fail_json ( msg = e . message , ** camel_dict_to_snake_dict ( e . response ) ) matched_asgs = [ ] if ( name is not None ) : name_prog = re . compile ( ( '^' + name ) ) for asg in asgs [ 'AutoScalingGroups' ] : if name : matched_name = name_prog . search ( asg [ 'AutoScalingGroupName' ] ) else : matched_name = True if tags : matched_tags = match_asg_tags ( tags , asg ) else : matched_tags = True if ( matched_name and matched_tags ) : matched_asgs . append ( camel_dict_to_snake_dict ( asg ) ) return matched_asgs
args: conn : valid boto3 asg client .