<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _calc_ticks(value_range, base):
 """ Calculate tick marks within a range Parameters value_range: tuple Range for which to calculate ticks. Returns ------- out: tuple (major, middle, minor) tick locations """

        def _minor(x, mid_idx):
            return np.hstack([x[1:mid_idx], x[mid_idx+1:-1]])

        # * Calculate the low and high powers,
        # * Generate for all intervals in along the low-high power range
        #   The intervals are in normal space
        # * Calculate evenly spaced breaks in normal space, then convert
        #   them to log space.
        low = np.floor(value_range[0])
        high = np.ceil(value_range[1])
        arr = base ** np.arange(low, float(high+1))
        n_ticks = base - 1
        breaks = [log(np.linspace(b1, b2, n_ticks+1), base)
                  for (b1, b2) in list(zip(arr, arr[1:]))]

        # Partition the breaks in the 3 groups
        major = np.array([x[0] for x in breaks] + [breaks[-1][-1]])
        if n_ticks % 2:
            mid_idx = n_ticks // 2
            middle = [x[mid_idx] for x in breaks]
            minor = np.hstack([_minor(x, mid_idx) for x in breaks])
        else:
            middle = []
            minor = np.hstack([x[1:-1] for x in breaks])

        return major, middle, minor