def checkBoundsInSolution(solution):
    """ check if flux distribution 'solution' violates any of the flux bounds
        associated with its reactions

    Returns:  lbViolations, ubViolations - {reaction : flux, bound} dicts
    """
    lbViolations, ubViolations = {}, {}
    for rea in solution:
        flux = solution[rea]
        if rea not in solution.boundsDict:
            continue
        lb, ub = solution.boundsDict[rea]
        if flux < lb:
            lbViolations[rea] = flux, lb
        elif flux > ub:
            ubViolations[rea] = flux, ub
    return lbViolations, ubViolations
