<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def optimizer(name):
 """Get pre-registered optimizer keyed by name. `name` should be snake case, though SGD -> sgd, RMSProp -> rms_prop and UpperCamelCase -> snake_case conversions included for legacy support. Args: name: name of optimizer used in registration. This should be a snake case identifier, though others supported for legacy reasons. Returns: optimizer """

  warn_msg = ("Please update `registry.optimizer` callsite "
              "(likely due to a `HParams.optimizer` value)")
  if name == "SGD":
    name = "sgd"
    tf.logging.warning("'SGD' optimizer now keyed by 'sgd'. %s" % warn_msg)
  elif name == "RMSProp":
    name = "rms_prop"
    tf.logging.warning(
        "'RMSProp' optimizer now keyed by 'rms_prop'. %s" % warn_msg)
  else:
    snake_name = misc_utils.camelcase_to_snakecase(name)
    if name != snake_name:
      tf.logging.warning(
          "optimizer names now keyed by snake_case names. %s" % warn_msg)
      name = snake_name
  return Registries.optimizers[name]