def convert_to_bytes(param):
 if (param is None):
  return None
 param = ''.join(param.split())
 if (param[(-3)].lower() in ['k', 'm', 'g', 't', 'p']):
  return (int(param[:(-3)]) * BYTES_MAP.get(param[(-3):].lower(), 1))
 elif param.isdigit():
  return (int(param) * (2 ** 10))
 else:
  raise ValueError("Unsupported value(IEC supported): '{value}'".format(value=param))

def convert_to_bytes ( param ) : if ( param is None ) : return None param = '' . join ( param . split ( ) ) if ( param [ ( - 3 ) ] . lower ( ) in [ 'k' , 'm' , 'g' , 't' , 'p' ] ) : return ( int ( param [ : ( - 3 ) ] ) * BYTES_MAP . get ( param [ ( - 3 ) : ] . lower ( ) , 1 ) ) elif param . isdigit ( ) : return ( int ( param ) * ( 2 ** 10 ) ) else : raise ValueError ( "Unsupported value(IEC supported): '{value}'" . format ( value = param ) )
take a string in the form 1234k .