def fred_apikey_set(apikey, filename=None):
    """Store the Fred Token in $HOME/.updoon_fred

    Parameters:
    -----------
    apikey : str
        The API Key from the Fred Website.
        See https://research.stlouisfed.org/useraccount/apikeys

    filename : str
        Absolute path to the text where the
        Fred API Key is stored (Optional)

    """
    if filename is None:
        import pathlib
        filename = str(pathlib.Path.home()) + '/.updoon_fred'
    fileptr = open(filename, 'w')
    fileptr.write(apikey)
    fileptr.close()
    return None
