def errno_from_exception(e):
 if hasattr(e, 'errno'):
  return e.errno
 elif e.args:
  return e.args[0]
 else:
  return None

def errno_from_exception ( e ) : if hasattr ( e , 'errno' ) : return e . errno elif e . args : return e . args [ 0 ] else : return None
provides the errno from an exception object .