def compute_default(kwargs):
    """Compute the default value to display in help for an option registered with these kwargs."""
    ranked_default = kwargs.get('default')
    typ = kwargs.get('type', str)

    default = ranked_default.value if ranked_default else None
    if default is None:
      return 'None'

    if typ == list:
      default_str = '[{}]'.format(','.join(["'{}'".format(s) for s in default]))
    elif typ == dict:
      if default:
        default_str = '{{ {} }}'.format(
          ','.join(["'{}':'{}'".format(k, v) for k, v in default.items()]))
      else:
        default_str = '{}'
    elif typ == str:
      default_str = "'{}'".format(default).replace('\n', ' ')
    else:
      default_str = str(default)
    return default_str
Compute the default value to display in help for an option registered with these kwargs.