def allow_port(port, proto='tcp', direction='both'):
 ports = get_ports(proto=proto, direction=direction)
 direction = direction.upper()
 _validate_direction_and_proto(direction, proto)
 directions = build_directions(direction)
 results = []
 for direction in directions:
  _ports = ports[direction]
  _ports.append(port)
  results += allow_ports(_ports, proto=proto, direction=direction)
 return results

def allow_port ( port , proto = 'tcp' , direction = 'both' ) : ports = get_ports ( proto = proto , direction = direction ) direction = direction . upper ( ) _validate_direction_and_proto ( direction , proto ) directions = build_directions ( direction ) results = [ ] for direction in directions : _ports = ports [ direction ] _ports . append ( port ) results += allow_ports ( _ports , proto = proto , direction = direction ) return results
like allow_ports .