Add read function, adopted from https://github.com/hynek/pem/blob/master/setup.py