def jgetattr(data, attr, default=None):
 try:
  return getattr(data, attr, default)
 except py4j.protocol.Py4JJavaError:
  return default

def jgetattr ( data , attr , default = None ) : try : return getattr ( data , attr , default ) except py4j . protocol . Py4JJavaError : return default
sparks api doesnt properly implement the getattr interface .