def cards_left(instance):
  """ Return the number of cards left to deal before a shuffle is required.

  Args:
    instance: The GameInstance database model for this operation.

  Returns
    The number of cards that can still be dealt before the deck is
    empty. If the deck has not been set or no cards have been dealt
    (in the case that the default deck is being used), returns -1.
  """
  if 'crd_deck' not in instance.dynamic_properties():
    return -1
  return len(instance.crd_deck) - instance.crd_deck_index