def make_credfile():
    """Utility function to make a file to store your hiev key that won't get pushed to github.
    Simply call make_credfile() from the terminal and paste your key when it calls for it :)
    
    """
    key = input("please paste hiev key and hit enter: ")
    if not has_imported("os"): #if __init__.py hasn't been run os won't have been imported
        import os
    os.system("echo hiev_api_key='" +key+"' > credentials.py") #Yes os.system is discouraged, but as os is already used in __init__.py and the flexibility of the subprocess library is unneeded
    os.system("echo credentials.py > .gitignore") #ensures credentials.py is not pushed to github
    print("Now you are ready to use\n\
          import credentials as c\n\
          key_file=c.hiev_api_key")
    return

    
def is_toa5(record):
    """ Utility function to check if a supplied record (as generated by hievpy.search) is in TOA5 format

    Input
    -----
    Required
    - record: record object returned by the search function

    Returns
    -------
    True or False

    """

    if record['format'] == 'TOA5' and record['file_processing_status'] == 'RAW':
        return True

    return False
