def parseSdr(s):
 assert isinstance(s, basestring)
 sdr = [int(c) for c in s if (c in ('0', '1'))]
 if (len(sdr) != len(s)):
  raise ValueError("The provided string %s is malformed. The string should have only 0's and 1's.")
 return sdr

def parseSdr ( s ) : assert isinstance ( s , basestring ) sdr = [ int ( c ) for c in s if ( c in ( '0' , '1' ) ) ] if ( len ( sdr ) != len ( s ) ) : raise ValueError ( "The provided string %s is malformed. The string should have only 0's and 1's." ) return sdr
parses a string containing only 0s and 1s and return a python list object .