def _build_filename_from_browserstack_json(j):
filename = '<STR_LIT>'<EOL>device = j['<STR_LIT>'] if j['<STR_LIT>'] else '<STR_LIT>'<EOL>if j['<STR_LIT:state>'] == '<STR_LIT>' and j['<STR_LIT>']:<EOL><INDENT>detail = [device, j['<STR_LIT>'], j['<STR_LIT>'],<EOL>j['<STR_LIT>'], j['<STR_LIT>'], '<STR_LIT>']<EOL>filename = '<STR_LIT:_>'.join(item.replace("<STR_LIT:U+0020>", "<STR_LIT:_>") for item in detail if item)<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>return filename<EOL>
Build a useful filename for an image from the screenshot json metadata