'Expand cron specification.
Takes the given cronspec argument in one of the forms:
.. code-block:: text
int         (like 7)
str         (like \'3-5,*/15\', \'*\', or \'monday\')
set         (like {0,15,30,45}
list        (like [8-17])
And convert it to an (expanded) set representing all time unit
values on which the Crontab triggers.  Only in case of the base
type being :class:`str`, parsing occurs.  (It\'s fast and
happens only once for each Crontab instance, so there\'s no
significant performance overhead involved.)
For the other base types, merely Python type conversions happen.
The argument ``max_`` is needed to determine the expansion of
``*`` and ranges.  The argument ``min_`` is needed to determine
the expansion of ``*`` and ranges for 1-based cronspecs, such as
day of month or month of year.  The default is sufficient for minute,
hour, and day of week.'

@staticmethod
def _expand_cronspec(cronspec, max_, min_=0):

    if isinstance(cronspec, numbers.Integral):
        result = {cronspec}
    elif isinstance(cronspec, string_t):
        result = crontab_parser(max_, min_).parse(cronspec)
    elif isinstance(cronspec, set):
        result = cronspec
    elif isinstance(cronspec, Iterable):
        result = set(cronspec)
    else:
        raise TypeError(CRON_INVALID_TYPE.format(type=type(cronspec)))
    for number in result:
        if ((number >= (max_ + min_)) or (number < min_)):
            raise ValueError(CRON_PATTERN_INVALID.format(min=min_, max=((max_ - 1) + min_), value=number))
    return result
