code: def connect_s3_bucket_to_lambda(self, bucket, function_arn, events,
                                      prefix=None, suffix=None):
          # type: (str, str, List[str], OptStr, OptStr) -> None
          
          s3 = self._client('s3')
          existing_config = s3.get_bucket_notification_configuration(
              Bucket=bucket)
          # Because we're going to PUT this config back to S3, we need
          # to remove `ResponseMetadata` because that's added in botocore
          # and isn't a param of the put_bucket_notification_configuration.
          existing_config.pop('ResponseMetadata', None)
          existing_lambda_config = existing_config.get(
              'LambdaFunctionConfigurations', [])
          single_config = {
              'LambdaFunctionArn': function_arn, 'Events': events
          }  # type: Dict[str, Any]
          filter_rules = []
          if prefix is not None:
              filter_rules.append({'Name': 'Prefix', 'Value': prefix})
          if suffix is not None:
              filter_rules.append({'Name': 'Suffix', 'Value': suffix})
          if filter_rules:
              single_config['Filter'] = {'Key': {'FilterRules': filter_rules}}
          new_config = self._merge_s3_notification_config(existing_lambda_config,
                                                          single_config)
          existing_config['LambdaFunctionConfigurations'] = new_config
          s3.put_bucket_notification_configuration(
              Bucket=bucket,
              NotificationConfiguration=existing_config,
          )
docs: Configure S3 bucket to invoke a lambda function.
  
          The S3 bucket must already have permission to invoke the
          lambda function before you call this function, otherwise
          the service will return an error.  You can add permissions
          by using the ``add_permission_for_s3_event`` below.  The
          ``events`` param matches the event strings supported by the
          service.
  
          This method also only supports a single prefix/suffix for now,
          which is what's offered in the Lambda console.