title: Python unexpected NoneType in print()
body: <p>I am experiencing some strange behavior in one of my python scripts.</p>
  
  <p>I have a function which calculates the last connected date of an interface on a switch port.</p>
  
  <pre><code>def last_change(self):
      """
      Gets the date from the last time the interface status changed.
      ifLastChange time is relevant to sysUpTime and should thus be calculated as: sysUpTime-ifLastChange/100
      The ifLastChange and sysUpTime values are `Ticks` and should be handled as UNIX-Time
      :return: Date as string. Format DD.MM:YYYY hh:mm:ss
      """
      self.snmp_obj.mib = 'IF-MIB'
      self.snmp_obj.mib_object = 'ifLastChange'
      self.snmp_obj.match = self.ifindex
      snmp_response = self.snmp_obj.snmp_get_specific()
      sys_ticks = Switch.uptime(self)
      int_ticks = snmp_response[1].strip("'")
      tick_diff = int(sys_ticks) - int(int_ticks)
      chtime = datetime.timedelta(seconds=tick_diff / 100)
      print((datetime.datetime.today() - chtime).strftime('%d.%m.%Y %H:%M:%S'))
      return str((datetime.datetime.today() - chtime).strftime('%d.%m.%Y %H:%M:%S'))
  </code></pre>
  
  <p>I call the function on my <code>interface</code> object in my code as follows:</p>
  
  <pre><code>            print(interface.last_change())
              print('HOSTNAME: ' + device_hostname +
                              '\nUSERNAME: ' + device_user +
                              '\nIFNAME: ' + ifname +
                              '\nIFINDEX: ' + ifindex +
                              '\nBPI: ' + bpi +
                              '\nIFSTATUS: ' + ifstatus +
                              '\nVLAN: ' + ifvlan +
                              '\nMAC: ' + mac_address +
                              '\nTRUNKSTATUS: ' + trunk_status +
                              '\nPORTSEC_STATE: ' + interface.portsec_state() +
                              '\nPORTSEC_STATUS: ' + interface.portsec_status() +
                              '\nMAXMAC: ' + interface.max_macaddresses() +
                              '\nLAST_CHNAGE: ' + interface.last_change())
  </code></pre>
  
  <p>Now interestingly, <code>print(interface.last_change())</code> works, but in the "big" <code>print()</code> function an error is raised.</p>
  
  <pre><code>02.07.2016 10:09:27
  Traceback (most recent call last):
    File "portfynder.py", line 171, in &lt;module&gt;
      main()
    File "portfynder.py", line 140, in main
      '\nLAST_CHNAGE: ' + interface.last_change())
  TypeError: must be str, not NoneType
  </code></pre>
  
  <p>As seen in the output above, <code>print(interface.last_change())</code> works and also returns a <code>str</code> value (<code>02.07.2016 10:09:27</code>). But for some reason it returns a <code>NoneType</code> in the big <code>print()</code> function.</p>
  
  <p>I have no idea why this is happening, any ideas?</p>