code: def _generate_event_resources(self, lambda_function, execution_role, event_resources, lambda_alias=None):
          
          resources = []
          if self.Events:
              for logical_id, event_dict in self.Events.items():
                  try:
                      eventsource = self.event_resolver.resolve_resource_type(event_dict).from_dict(
                          lambda_function.logical_id + logical_id, event_dict, logical_id)
                  except TypeError as e:
                      raise InvalidEventException(logical_id, "{}".format(e))
  
                  kwargs = {
                      # When Alias is provided, connect all event sources to the alias and *not* the function
                      'function': lambda_alias or lambda_function,
                      'role': execution_role,
                  }
  
                  for name, resource in event_resources[logical_id].items():
                      kwargs[name] = resource
                  resources += eventsource.to_cloudformation(**kwargs)
  
          return resources
docs: Generates and returns the resources associated with this function's events.
  
          :param model.lambda_.LambdaFunction lambda_function: generated Lambda function
          :param iam.IAMRole execution_role: generated Lambda execution role
          :param implicit_api: Global Implicit API resource where the implicit APIs get attached to, if necessary
          :param implicit_api_stage: Global implicit API stage resource where implicit APIs get attached to, if necessary
          :param event_resources: All the event sources associated with this Lambda function
          :param model.lambda_.LambdaAlias lambda_alias: Optional Lambda Alias resource if we want to connect the
              event sources to this alias
  
          :returns: a list containing the function's event resources
          :rtype: list