lines 72-92 need DRY (don't repeat yourself) refactoring. Except for the class name, there is nothing different between these cases. Just set the class depending on the value of ``frame_type`` and then use this class to create a new instance and append it to ``frame_list``. Untested:

```python
# TODO: use a better name than cls
cls = {
    'Spatial': SpatialFrame,
    'Time': CoordinateFrame,
    'Spectral': SpectralFrame}.get(frame_type)
assert cls is not None  # FIXME: or could it possibly happen that frame_type is neither 'Spatial' nor 'Time' nor 'Spectral'?
frame_list.append(cls(
    reference_position=crpixs[i][1],
    pixel_size=cdelts[i][1],
    number_of_pixels=naxiss[i][1],
    axes_names=None,
    units=[cunits[i][1]]))
```