Small useful Python functions