def _parse_forward(mapping):
 if (len(mapping.split(':')) > 3):
  (srcport, destport, protocol, destaddr) = mapping.split(':')
 else:
  (srcport, destport, protocol) = mapping.split(':')
  destaddr = ''
 return ForwardingMapping(srcport, destport, protocol, destaddr)

def _parse_forward ( mapping ) : if ( len ( mapping . split ( ':' ) ) > 3 ) : ( srcport , destport , protocol , destaddr ) = mapping . split ( ':' ) else : ( srcport , destport , protocol ) = mapping . split ( ':' ) destaddr = '' return ForwardingMapping ( srcport , destport , protocol , destaddr )
parses a port forwarding statement in the form used by this state: from_port:to_port:protocol[:destination] and returns a forwardingmapping object .