def getZfromFileName(fileName, suppress = False):
    """
    Lifts a redshift from a file name.

    Assumes file names are formatted as "...zX.XXX..." where X.XXX is the
    redshift.

    Parameters
    ----------
    fileName : str
    suppress : bool, default = False
        Whether or not to suppress error messages. If no single redshift is
        found and suppress is True, will return None

    Returns
    -------
    z : float
    """
    #first we find where all of the "z" characters are in the name
    zIndexes = [pos for pos, char in enumerate(fileName) if char == 'z']
    zs = list()
    for zIndex in zIndexes:
        try:
            zs.append( float(fileName[zIndex+1:zIndex+6]) )
        except ValueError:
            #bit of string after the z is not a number
            pass
    if len(zs) == 0:
        msg = "Could not find a redshift in file name {0}\nPlease check the name is formatted as '...zX.XXX...'".format(fileName)
        if not suppress:
            raise ValueError(msg)
        else:
            return
    elif len(zs) > 1:
        msg = "Found multiple redshifts in file name {0}".format(fileName)
        if not suppress:
            raise ValueError(msg)
        else:
            return
    return zs[0]