def _get_amount(kwargs):
    """Helper function intended for internal use. Checks validity of `amount` kwarg."""
    amount = kwargs['amount']
    if not isinstance(amount, int):
        raise TypeError('Expected integer amount')
    if not amount >= 0:
        raise ValueError('Expected non-negative amount')
    return amount
