call the method self.extra_headers.get with string 'From' and self.from_email as arguments, substitute the result for value under the 'From' key of msg dictionary.
msg [ 'From' ] = self . extra_headers . get ( 'From' , self . from_email )