def _get_member(var, name):
  """Returns the member named name from var.

  This can be a dictionary member or a class member, i.e. if var is a dict,
  it returns var[name], and if var is a class, it returns var.name.
  If member isn't present or wrong type, returns an empty string.
  """
  try:
    return var[name]
  except KeyError:
    return ""
  except TypeError:
    pass
  try:
    return var.__getattribute__(name)
  except KeyError:
    return ""
  except AttributeError:
    return ""
  # Shouldn't happen
  raise RenderingError("Wrong type %s" % type(var))