Extract a value from a source, transform and return it.

def get_val(source, extract=None, transform=None):
  """Extract a value from a source, transform and return it."""
  if extract is None:
    raw_value = source
  else:
    raw_value = extract(source)

  if transform is None:
    return raw_value
  else:
    return transform(raw_value)