def _get_col_attributes(col):
 attrs = ColumnDict()
 attrs['name'] = col.info.name
 type_name = col.info.dtype.type.__name__
 if ((not six.PY2) and type_name.startswith(('bytes', 'str'))):
  type_name = 'string'
 if type_name.endswith('_'):
  type_name = type_name[:(-1)]
 attrs['datatype'] = type_name
 for (attr, nontrivial, xform) in (('unit', (lambda x: (x is not None)), str), ('format', (lambda x: (x is not None)), None), ('description', (lambda x: (x is not None)), None), ('meta', (lambda x: x), None)):
  col_attr = getattr(col.info, attr)
  if nontrivial(col_attr):
   attrs[attr] = (xform(col_attr) if xform else col_attr)
 return attrs

def _get_col_attributes ( col ) : attrs = ColumnDict ( ) attrs [ 'name' ] = col . info . name type_name = col . info . dtype . type . __name__ if ( ( not six . PY2 ) and type_name . startswith ( ( 'bytes' , 'str' ) ) ) : type_name = 'string' if type_name . endswith ( '_' ) : type_name = type_name [ : ( - 1 ) ] attrs [ 'datatype' ] = type_name for ( attr , nontrivial , xform ) in ( ( 'unit' , ( lambda x : ( x is not None ) ) , str ) , ( 'format' , ( lambda x : ( x is not None ) ) , None ) , ( 'description' , ( lambda x : ( x is not None ) ) , None ) , ( 'meta' , ( lambda x : x ) , None ) ) : col_attr = getattr ( col . info , attr ) if nontrivial ( col_attr ) : attrs [ attr ] = ( xform ( col_attr ) if xform else col_attr ) return attrs
extract information from a column that is required to fully serialize the column .