def Prefix(string, pad, length):
  """
  Prefix the supplied string until it is the desired length, with the given
  padding character
  """

  assert(len(string) <= length)
  assert(len(pad) == 1)
  
  result = ""
  while len(string) + len(result) < length:
    result += pad
  result += string
  
  return result