Mimicking Fortran string properties using Python/h5py

I am trying to create an attribute in HDF5 using Python and h5py with the following properties/type info:

ATTRIBUTE “description” {
DATATYPE H5T_STRING {
STRSIZE 71;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;

This is an h5dump result using an HDF5 file generated by a Fortran program. I want to produce the same thing via h5py and Python. (Of course, STRSIZE will vary with the string length.) I’ve tried several different approaches. The core problem seems to be that when I get h5py to produce a NULLTERM it also produces H5T_VARIABLE instead of STRSIZE, and when I can get STRSIZE h5py produces NULLPAD.

I’ve found a solution which looks like it works from a previous Forum post: