<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_username(self, username = None):
 """This method is used to set the username. username must be a string. """

        
        if username is None or type(username) is not str:
            raise KPError("Need a new image number")
        else:
            self.username = username
            self.last_mod = datetime.now().replace(microsecond=0)
            return True