def _construct_role(self, managed_policy_map):
execution_role = IAMRole(self.logical_id + '<STR_LIT>', attributes=self.get_passthrough_resource_attributes())<EOL>execution_role.AssumeRolePolicyDocument = IAMRolePolicies.lambda_assume_role_policy()<EOL>managed_policy_arns = [ArnGenerator.generate_aws_managed_policy_arn('<STR_LIT>')]<EOL>if self.Tracing:<EOL><INDENT>managed_policy_arns.append(ArnGenerator.generate_aws_managed_policy_arn('<STR_LIT>'))<EOL><DEDENT>function_policies = FunctionPolicies({"<STR_LIT>": self.Policies},<EOL>policy_template_processor=None)<EOL>policy_documents = []<EOL>if self.DeadLetterQueue:<EOL><INDENT>policy_documents.append(IAMRolePolicies.dead_letter_queue_policy(<EOL>self.dead_letter_queue_policy_actions[self.DeadLetterQueue['<STR_LIT>']],<EOL>self.DeadLetterQueue['<STR_LIT>']))<EOL><DEDENT>for index, policy_entry in enumerate(function_policies.get()):<EOL><INDENT>if policy_entry.type is PolicyTypes.POLICY_STATEMENT:<EOL><INDENT>policy_documents.append({<EOL>'<STR_LIT>': execution_role.logical_id + '<STR_LIT>' + str(index),<EOL>'<STR_LIT>': policy_entry.data<EOL>})<EOL><DEDENT>elif policy_entry.type is PolicyTypes.MANAGED_POLICY:<EOL><INDENT>policy_arn = policy_entry.data<EOL>if isinstance(policy_entry.data, string_types) and policy_entry.data in managed_policy_map:<EOL><INDENT>policy_arn = managed_policy_map[policy_entry.data]<EOL><DEDENT>if policy_arn not in managed_policy_arns:<EOL><INDENT>managed_policy_arns.append(policy_arn)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise InvalidResourceException(<EOL>self.logical_id,<EOL>"<STR_LIT>".format(index))<EOL><DEDENT><DEDENT>execution_role.ManagedPolicyArns = list(managed_policy_arns)<EOL>execution_role.Policies = policy_documents or None<EOL>execution_role.PermissionsBoundary = self.PermissionsBoundary<EOL>return execution_role<EOL>
Constructs a Lambda execution role based on this SAM function's Policies property.

        :returns: the generated IAM Role
        :rtype: model.iam.IAMRole