def set_priority(self, p_priority):
        """
        Sets the priority of the todo. Must be a single capital letter [A-Z],
        or None to unset the priority.
        Priority remains unchanged when an invalid priority is given, or when
        the task was completed.
        """
        if not self.is_completed() and (p_priority is None or
                                        is_valid_priority(p_priority)):
            self.fields['priority'] = p_priority

            priority_str = '' if p_priority is None else '(' + p_priority + ') '
            self.src = re.sub(r'^(\([A-Z]\) )?', priority_str, self.src)
Sets the priority of the todo. Must be a single capital letter [A-Z],
        or None to unset the priority.
        Priority remains unchanged when an invalid priority is given, or when
        the task was completed.