def findConfig(fileName):
    """
    Returns the name of a config file based on the given base file name (without extension).
    Returns either a filename which endswith .json, .yaml or None
    """

    fileExt = os.path.splitext(fileName)[1]

    # Auto discovery
    if not fileExt:
        for tryExt in (".json", ".yaml"):
            if os.path.exists(fileName + tryExt):
                return fileName + tryExt

        return None  

    if os.path.exists(fileName) and fileExt in (".json", ".yaml"):
        return fileName  
    else:
        return None
dataset/ETHPy150Open zynga/jasy/jasy/core/Config.py/findConfig/original