automatic file type detection, if none assume python dict