'Returns either the original or averaged version of a given variable.
If the master.read_from_avg flag is set to True, and the
ExponentialMovingAverage (EMA) object has been attached, then this will ask
the EMA object for the given variable.
This is to allow executing inference from the averaged version of
parameters.
Arguments:
var_name: Name of the variable.
var_params: tf.Variable for which to retrieve an average.
Only one of |var_name| or |var_params| needs to be provided.  If both are
provided, |var_params| takes precedence.
Returns:
tf.Variable object corresponding to original or averaged version.'

def get_variable(self, var_name=None, var_params=None):

    if var_params:
        var_name = var_params.name
    else:
        check.NotNone(var_name, 'specify    at    least    one    of    var_name    or    var_params')
        var_params = tf.get_variable(var_name)
    if (self.moving_average and self.master.read_from_avg):
        logging.info('Retrieving    average    for:    %s', var_name)
        var_params = self.moving_average.average(var_params)
        assert var_params
    logging.info('Returning:    %s', var_params.name)
    return var_params
