def get_optimizer(optimizer_type, learning_rate, **kwargs):
  """Creates optimizer with learning rate.

  Currently supported optimizers include:
    'ADAGRAD'

  Args:
    optimizer_type: A string for the type of optimizer to choose.
    learning_rate: A float or tensor for the learning rate.
    **kwargs: A dictionary of assorted arguments used by optimizers, keyed in
      the format of '${optimizer_type}_${arg}'.

  Returns:
    optimizer: An optimizer class object.

  Raises:
    ValueError: If the optimizer type is not supported.
  """
  if optimizer_type == 'ADAGRAD':
    optimizer = tf.train.AdagradOptimizer(
        learning_rate,
        initial_accumulator_value=kwargs.get(
            'ADAGRAD_initial_accumulator_value', 0.1))
  elif optimizer_type == 'ADAM':
    optimizer = tf.train.AdamOptimizer(
        learning_rate,
        beta1=kwargs.get('ADAM_beta1', 0.9),
        beta2=kwargs.get('ADAM_beta2', 0.999),
        epsilon=kwargs.get('ADAM_epsilon', 1e-8))
  elif optimizer_type == 'RMSPROP':
    optimizer = tf.train.RMSPropOptimizer(
        learning_rate=learning_rate,
        decay=kwargs.get('RMSPROP_decay', 0.9),
        momentum=kwargs.get('RMSPROP_momentum', 0.9),
        epsilon=kwargs.get('RMSPROP_epsilon', 1e-10))
  else:
    raise ValueError('Unsupported optimizer type: `%s`.' % str(optimizer_type))

  return optimizer