def is_valid_filename(filename):
    """Check if a file has a valid filename (valid chars and max length gotten from
    stack overflow and other sources, may be wrong)"""
    # Added some accents, ö and stuff like that is still verboten
    valid_chars = '-_.() abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789àèéíóòúüÀÈÉÍÒÓÚÜ'
    if len(filename) > 260:
        return False
    for char in filename:
        if char not in valid_chars:
            return False
    return True