+def request_ttype(user):
+ """Clear and request the terminal type."""
+
+ # only actually request if the corresponding telopt is enabled
+ if is_enabled(user, TELOPT_TTYPE, HIM):
+ # set to the empty string to indicate it's been requested
+ user.ttype = ""
+ user.send(telnet_proto(IAC, SB, TELOPT_TTYPE, SEND, IAC, SE), raw=True)
+ log('Sent terminal type request to', user)
+
+