def apply_tf(data, tf):
    """Apply function `tf` (transformation function) if specified
    and return result. Return unmodified data in other case"""
    if tf:
      return tf(data)
    else:
      return data