code: def get_function(session_factory, name, handler, runtime, role,
                   log_groups,
                   project, account_name, account_id,
                   sentry_dsn,
                   pattern="Traceback"):
      
      # Lazy import to avoid runtime dependency
      from c7n.mu import (
          LambdaFunction, PythonPackageArchive, CloudWatchLogSubscription)
  
      config = dict(
          name=name,
          handler=handler,
          runtime=runtime,
          memory_size=512,
          timeout=15,
          role=role,
          description='Custodian Sentry Relay',
          events=[
              CloudWatchLogSubscription(
                  session_factory, log_groups, pattern)])
  
      archive = PythonPackageArchive('c7n_sentry')
      archive.add_contents(
          'config.json', json.dumps({
              'project': project,
              'account_name': account_name,
              'account_id': account_id,
              'sentry_dsn': sentry_dsn,
          }))
      archive.add_contents(
          'handler.py',
          'from c7n_sentry.c7nsentry import process_log_event'
      )
      archive.close()
  
      return LambdaFunction(config, archive)
docs: Lambda function provisioning.
  
      Self contained within the component, to allow for easier reuse.