def _check_max_count(count):
    """Checks if the input value is valid (either None or a positive >= 1
    number.

    Parameters
    ----------
    count : int
        Input integer.

    Returns
    -------
    count: int
        Output integer. Returns the input integer if valid.

    Raises
    -------
    ValueError
        If `count` is not None or a positive number.

    """
    if count is not None:
        count = int(count)
        if count < 1:
            raise ValueError("`count` must be None or a positive integer.")
        return count