def to_cloudformation(self, **kwargs):
function = kwargs.get('<STR_LIT>')<EOL>if not function:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>resources = []<EOL>lambda_eventsourcemapping = LambdaEventSourceMapping(self.logical_id)<EOL>resources.append(lambda_eventsourcemapping)<EOL>try:<EOL><INDENT>function_name_or_arn = function.get_runtime_attr("<STR_LIT:name>")<EOL><DEDENT>except NotImplementedError:<EOL><INDENT>function_name_or_arn = function.get_runtime_attr("<STR_LIT>")<EOL><DEDENT>if not self.Stream and not self.Queue:<EOL><INDENT>raise InvalidEventException(<EOL>self.relative_id, "<STR_LIT>")<EOL><DEDENT>if self.Stream and not self.StartingPosition:<EOL><INDENT>raise InvalidEventException(<EOL>self.relative_id, "<STR_LIT>")<EOL><DEDENT>lambda_eventsourcemapping.FunctionName = function_name_or_arn<EOL>lambda_eventsourcemapping.EventSourceArn = self.Stream or self.Queue<EOL>lambda_eventsourcemapping.StartingPosition = self.StartingPosition<EOL>lambda_eventsourcemapping.BatchSize = self.BatchSize<EOL>lambda_eventsourcemapping.Enabled = self.Enabled<EOL>if '<STR_LIT>' in function.resource_attributes:<EOL><INDENT>lambda_eventsourcemapping.set_resource_attribute('<STR_LIT>', function.resource_attributes['<STR_LIT>'])<EOL><DEDENT>if '<STR_LIT>' in kwargs:<EOL><INDENT>self._link_policy(kwargs['<STR_LIT>'])<EOL><DEDENT>return resources<EOL>
Returns the Lambda EventSourceMapping to which this pull event corresponds. Adds the appropriate managed
        policy to the function's execution role, if such a role is provided.

        :param dict kwargs: a dict containing the execution role generated for the function
        :returns: a list of vanilla CloudFormation Resources, to which this pull event expands
        :rtype: list