Converted the soft_limit() and usage() functions to Python