def ShlexSplit(string):
  """A wrapper for `shlex.split` that works with unicode objects.

  Args:
    string: A unicode string to split.

  Returns:
    A list of unicode strings representing parts of the input string.
  """
  precondition.AssertType(string, Text)

  if PY2:
    string = string.encode("utf-8")

  parts = shlex.split(string)

  if PY2:
    # TODO(hanuszczak): https://github.com/google/pytype/issues/127
    # pytype: disable=attribute-error
    parts = [part.decode("utf-8") for part in parts]
    # pytype: enable=attribute-error

  return parts