def _screen_file_extensions(preferred_extension):
    """
    Return a prioritized list of screen file extensions.

    Include .ui & .py files (also .adl files if adl2pydm installed).
    Prefer extension as described by fname.
    """
    extensions = [".py", ".ui"]  # search for screens with these extensions
    try:
        extensions.append(".adl")
    except ImportError:
        pass

    # don't search twice for preferred extension
    if preferred_extension in extensions:
        extensions.remove(preferred_extension)

    # search first for preferred extension
    extensions.insert(0, preferred_extension)
    return extensions