literal translation of hcp.m to hcp.py