def flash_size_bytes(size):
 if ('MB' in size):
  return ((int(size[:size.index('MB')]) * 1024) * 1024)
 elif ('KB' in size):
  return (int(size[:size.index('KB')]) * 1024)
 else:
  raise FatalError(('Unknown size %s' % size))

def flash_size_bytes ( size ) : if ( 'MB' in size ) : return ( ( int ( size [ : size . index ( 'MB' ) ] ) * 1024 ) * 1024 ) elif ( 'KB' in size ) : return ( int ( size [ : size . index ( 'KB' ) ] ) * 1024 ) else : raise FatalError ( ( 'Unknown size %s' % size ) )
given a flash size of the type passed in args .