def get_lan_ip():
 try:
  return [l for l in ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if (not ip.startswith(u'127.'))][:1], [[(s.connect((u'8.8.8.8', 80)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) if l][0][0]
 except:
  return socket.gethostname()

def get_lan_ip ( ) : try : return [ l for l in ( [ ip for ip in socket . gethostbyname_ex ( socket . gethostname ( ) ) [ 2 ] if ( not ip . startswith ( u'127.' ) ) ] [ : 1 ] , [ [ ( s . connect ( ( u'8.8.8.8' , 80 ) ) , s . getsockname ( ) [ 0 ] , s . close ( ) ) for s in [ socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) ] ] [ 0 ] [ 1 ] ] ) if l ] [ 0 ] [ 0 ] except : return socket . gethostname ( )
returns ip of system .