code: def add_lambda_permissions(function='',
                             statement_id='',
                             action='lambda:InvokeFunction',
                             principal='',
                             source_arn='',
                             env='',
                             region='us-east-1'):
      
      session = boto3.Session(profile_name=env, region_name=region)
      lambda_client = session.client('lambda')
      response_action = None
      prefixed_sid = FOREMAST_PREFIX + statement_id
  
      add_permissions_kwargs = {
          'FunctionName': function,
          'StatementId': prefixed_sid,
          'Action': action,
          'Principal': principal,
      }
  
      if source_arn:
          add_permissions_kwargs['SourceArn'] = source_arn
  
      try:
          lambda_client.add_permission(**add_permissions_kwargs)
          response_action = 'Add permission with Sid: {}'.format(prefixed_sid)
      except boto3.exceptions.botocore.exceptions.ClientError as error:
          LOG.debug('Add permission error: %s', error)
          response_action = "Did not add permissions"
  
      LOG.debug('Related StatementId (SID): %s', prefixed_sid)
      LOG.info(response_action)
docs: Add permission to Lambda for the event trigger.
  
      Args:
          function (str): Lambda function name
          statement_id (str): IAM policy statement (principal) id
          action (str): Lambda action to allow
          principal (str): AWS principal to add permissions
          source_arn (str): ARN of the source of the event. Only needed for S3
          env (str): Environment/account of function
          region (str): AWS region of function