def _is_valid_target(target, target_name, target_ports, is_pair):
 if is_pair:
  return ((target[:utils.PORT_ID_LENGTH] in target_ports) and (target_name == _PAIR_TARGET_NAME))
 if ((target[:utils.PORT_ID_LENGTH] not in target_ports) or (not target_name.startswith(utils.TARGET_PREFIX)) or (target_name == _PAIR_TARGET_NAME)):
  return False
 return True

def _is_valid_target ( target , target_name , target_ports , is_pair ) : if is_pair : return ( ( target [ : utils . PORT_ID_LENGTH ] in target_ports ) and ( target_name == _PAIR_TARGET_NAME ) ) if ( ( target [ : utils . PORT_ID_LENGTH ] not in target_ports ) or ( not target_name . startswith ( utils . TARGET_PREFIX ) ) or ( target_name == _PAIR_TARGET_NAME ) ) : return False return True
return true if the specified target is valid .