code: def deal(self, num=1, end=TOP):
          
          ends = {TOP: self.cards.pop, BOTTOM: self.cards.popleft}
  
          self_size = self.size
  
          if num <= self_size:
              dealt_cards = [None] * num
          else:
              num = self_size
              dealt_cards = [None] * self_size
  
          if self_size:
              for n in xrange(num):
                  try:
                      card = ends[end]()
                      dealt_cards[n] = card
                  except:
                      break
  
              return Stack(cards=dealt_cards)
          else:
              return Stack()
docs: Returns a list of cards, which are removed from the Stack.
  
          :arg int num:
              The number of cards to deal.
          :arg str end:
              Which end to deal from. Can be ``0`` (top) or ``1`` (bottom).
  
          :returns:
              The given number of cards from the stack.