def _check_portname(name):
 if ((not isinstance(name, string_types)) or ('/' not in name)):
  raise SaltInvocationError("Invalid port name '{0}' (category required)".format(name))
 path = os.path.join('/usr/ports', name)
 if (not os.path.isdir(path)):
  raise SaltInvocationError("Path '{0}' does not exist".format(path))
 return path

def _check_portname ( name ) : if ( ( not isinstance ( name , string_types ) ) or ( '/' not in name ) ) : raise SaltInvocationError ( "Invalid port name '{0}' (category required)" . format ( name ) ) path = os . path . join ( '/usr/ports' , name ) if ( not os . path . isdir ( path ) ) : raise SaltInvocationError ( "Path '{0}' does not exist" . format ( path ) ) return path
check if portname is valid and whether or not the directory exists in the ports tree .