import csv


def tsv_BS_rule_cpu(rule_file_name, current_cpu_id):
  """
  Load a list of B/S rules from a file. We assume the file is a
  tab-separated value (tsv) file with the B/S rule in the first
  column and a CPU number in the second column: "B3/S368\tCPU5"
  """
  #
  rule_list = []
  #
  with open(rule_file_name) as tsvfile:
    reader = csv.reader(tsvfile, delimiter = '\t')
    for row in reader:
      rule = row[0]
      cpu = row[1]
      if (("CPU" + str(current_cpu_id)) == cpu):
        rule_list.append(rule) 
  #
  return rule_list