code: def minutes_for_days(cal, ordered_days=False):
      """
      500 randomly selected days.
      This is used to make sure our test coverage is unbiased towards any rules.
      We use a random sample because testing on all the trading days took
      around 180 seconds on my laptop, which is far too much for normal unit
      testing.
  
      We manually set the seed so that this will be deterministic.
      Results of multiple runs were compared to make sure that this is actually
      true.
  
      This returns a generator of tuples each wrapping a single generator.
      Iterating over this yields a single day, iterating over the day yields
      the minutes for that day.
      """
      random.seed("deterministic")
      if ordered_days:
          # Get a list of 500 trading days, in order. As a performance
          # optimization in AfterOpen and BeforeClose, we rely on the fact that
          # the clock only ever moves forward in a simulation. For those cases,
          # we guarantee that the list of trading days we test is ordered.
          ordered_session_list = random.sample(
              list(cal.all_sessions), 500
          )
          ordered_session_list.sort()
  
          def session_picker(day):
              return ordered_session_list[day]
  
      else:
          # Other than AfterOpen and BeforeClose, we don't rely on the the nature
          # of the clock, so we don't care.
          def session_picker(day):
              return random.choice(cal.all_sessions[:-1])
  
      return [
          cal.minutes_for_session(session_picker(cnt))
          for cnt in range(500)
      ]
  
imports: import datetime
  from inspect import isabstract
  import random
  from unittest import TestCase
  import warnings
  from nose_parameterized import parameterized
  import pandas
  from six import iteritems
  from six.moves import range, map
  import catalyst.utils.events
  from catalyst.utils.calendars import get_calendar
  from catalyst.utils.events import EventRule, StatelessRule, Always, Never, AfterOpen, ComposedRule, BeforeClose, NotHalfDay, NthTradingDayOfWeek, NDaysBeforeLastTradingDayOfWeek, NthTradingDayOfMonth, NDaysBeforeLastTradingDayOfMonth, StatefulRule, OncePerDay, _build_offset, _build_date, _build_time, EventManager, Event, MAX_MONTH_RANGE, MAX_WEEK_RANGE, TradingDayOfMonthRule, TradingDayOfWeekRule
label_desc: Use image node_id 2 for calling a global function with example usage: minutes_for_days(cal, ordered_days) and returns: unknown, ordered_session_list, random