def add_substitution(self, substitution):
if substitution.personalization:<EOL><INDENT>try:<EOL><INDENT>personalization =self._personalizations[substitution.personalization]<EOL>has_internal_personalization = True<EOL><DEDENT>except IndexError:<EOL><INDENT>personalization = Personalization()<EOL>has_internal_personalization = False<EOL><DEDENT>personalization.add_substitution(substitution)<EOL>if not has_internal_personalization:<EOL><INDENT>self.add_personalization(<EOL>personalization, index=substitution.personalization)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if isinstance(substitution, list):<EOL><INDENT>for s in substitution:<EOL><INDENT>for p in self.personalizations:<EOL><INDENT>p.add_substitution(s)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for p in self.personalizations:<EOL><INDENT>p.add_substitution(substitution)<EOL><DEDENT><DEDENT><DEDENT>
Add a substitution to the email

        :param value: Add a substitution to the email
        :type value: Substitution