<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _building_cost(self, use_mix, stories):
 """ Generate building cost for a set of buildings Parameters use_mix : array The mix of uses for this form stories : series A Pandas Series of stories Returns ------- array The cost per sqft for this unit mix and height. """

        c = self.config
        # stories to heights
        heights = stories * c.height_per_story
        # cost index for this height
        costs = np.searchsorted(c.heights_for_costs, heights)
        # this will get set to nan later
        costs[np.isnan(heights)] = 0
        # compute cost with matrix multiply
        costs = np.dot(np.squeeze(c.costs[costs.astype('int32')]), use_mix)
        # some heights aren't allowed - cost should be nan
        costs[np.isnan(stories).flatten()] = np.nan
        return costs.flatten()