import itertools


def take(iterable, amount):
  """Return first n items of the iterable as a tuple.

  Taken from the Python documentation. Under the PSF license.

  :param amount:
      The number of items to obtain.
  :param iterable:
      Iterable sequence.
  :returns:
      First n items of the iterable as a tuple.
  """
  return tuple(itertools.islice(iterable, amount))