def mkswap(device):
 if (not ismounted(device)):
  run_as_root(('mkswap %(device)s' % locals()))
 else:
  abort('swap partition is mounted')

def mkswap ( device ) : if ( not ismounted ( device ) ) : run_as_root ( ( 'mkswap %(device)s' % locals ( ) ) ) else : abort ( 'swap partition is mounted' )
format swap partition example:: from fabtools .