def address(interface):
 with settings(hide('running', 'stdout')):
  res = sudo(("/sbin/ifconfig %(interface)s | grep 'inet '" % locals()))
 if ('addr' in res):
  return res.split()[1].split(':')[1]
 else:
  return res.split()[1]

def address ( interface ) : with settings ( hide ( 'running' , 'stdout' ) ) : res = sudo ( ( "/sbin/ifconfig %(interface)s | grep 'inet '" % locals ( ) ) ) if ( 'addr' in res ) : return res . split ( ) [ 1 ] . split ( ':' ) [ 1 ] else : return res . split ( ) [ 1 ]
get the ipv4 address assigned to an interface .