import re


def PipeFormat(contents):
  """Takes in contents of txt file that is delimited with pipes, orders data
  appropriately, converts gender letters into strings, and returns a list"""
  temp_list = []
  regexp_pipe = r"(\w+)\W+(\w+)\W+\w\W+(\w)\W+(\w+)\W+(\d+/\d+/\d+)"
  reg_return = re.findall(regexp_pipe, contents)

  for item in reg_return:
    (last, first, gender, color, dob) = item
    if gender == "M":
      gender = "Male"
    else:
      gender = "Female"
    temp_list.append([last, first, gender, dob, color])

  return temp_list