you should use a context manager here. if the next lines fails then `private_key` will not be closed.