Refactored functionality from concrete2json.py script to concrete.util module.