def check_charges(q, g):
    """Assert q and g are integers, q is positive, g nonnegative."""
    assert isinstance(q, int) and q > 0, 'q must be a positive integer.'
    assert isinstance(g, int) and g >= -1, 'g must be greater than -1.'
