def gamma_parameters(mean, var):
    """
    Returns tuple with scale and shape of gamma distribution
    based on a mean and variance.
    
    Keyword arguments:
    mean -- mean of the gamma dist
    var -- variance of the gamma dist
    """
    scale = var / mean
    shape = var / (scale ** 2)
    return scale, shape