def get_exif_tags(data, datetime_format='<STR_LIT>'):
logger = logging.getLogger(__name__)<EOL>simple = {}<EOL>for tag in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>if tag in data:<EOL><INDENT>if isinstance(data[tag], tuple):<EOL><INDENT>simple[tag] = data[tag][<NUM_LIT:0>].strip()<EOL><DEDENT>else:<EOL><INDENT>simple[tag] = data[tag].strip()<EOL><DEDENT><DEDENT><DEDENT>if '<STR_LIT>' in data:<EOL><INDENT>fnumber = data['<STR_LIT>']<EOL>try:<EOL><INDENT>simple['<STR_LIT>'] = float(fnumber[<NUM_LIT:0>]) / fnumber[<NUM_LIT:1>]<EOL><DEDENT>except Exception:<EOL><INDENT>logger.debug('<STR_LIT>', fnumber, exc_info=True)<EOL><DEDENT><DEDENT>if '<STR_LIT>' in data:<EOL><INDENT>focal = data['<STR_LIT>']<EOL>try:<EOL><INDENT>simple['<STR_LIT>'] = round(float(focal[<NUM_LIT:0>]) / focal[<NUM_LIT:1>])<EOL><DEDENT>except Exception:<EOL><INDENT>logger.debug('<STR_LIT>', focal,<EOL>exc_info=True)<EOL><DEDENT><DEDENT>if '<STR_LIT>' in data:<EOL><INDENT>exptime = data['<STR_LIT>']<EOL>if isinstance(exptime, tuple):<EOL><INDENT>try:<EOL><INDENT>simple['<STR_LIT>'] = str(fractions.Fraction(exptime[<NUM_LIT:0>],<EOL>exptime[<NUM_LIT:1>]))<EOL><DEDENT>except ZeroDivisionError:<EOL><INDENT>logger.info('<STR_LIT>', exptime)<EOL><DEDENT><DEDENT>elif isinstance(exptime, int):<EOL><INDENT>simple['<STR_LIT>'] = str(exptime)<EOL><DEDENT>else:<EOL><INDENT>logger.info('<STR_LIT>', exptime)<EOL><DEDENT><DEDENT>if data.get('<STR_LIT>'):<EOL><INDENT>simple['<STR_LIT>'] = data['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in data:<EOL><INDENT>date = data['<STR_LIT>'].rsplit('<STR_LIT:\x00>')[<NUM_LIT:0>]<EOL>try:<EOL><INDENT>simple['<STR_LIT>'] = datetime.strptime(date, '<STR_LIT>')<EOL>simple['<STR_LIT>'] = simple['<STR_LIT>'].strftime(datetime_format)<EOL><DEDENT>except (ValueError, TypeError) as e:<EOL><INDENT>logger.info('<STR_LIT>', e)<EOL><DEDENT><DEDENT>if '<STR_LIT>' in data:<EOL><INDENT>info = data['<STR_LIT>']<EOL>lat_info = info.get('<STR_LIT>')<EOL>lon_info = info.get('<STR_LIT>')<EOL>lat_ref_info = info.get('<STR_LIT>')<EOL>lon_ref_info = info.get('<STR_LIT>')<EOL>if lat_info and lon_info and lat_ref_info and lon_ref_info:<EOL><INDENT>try:<EOL><INDENT>lat = dms_to_degrees(lat_info)<EOL>lon = dms_to_degrees(lon_info)<EOL><DEDENT>except (ZeroDivisionError, ValueError, TypeError):<EOL><INDENT>logger.info('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>simple['<STR_LIT>'] = {<EOL>'<STR_LIT>': - lat if lat_ref_info != '<STR_LIT:N>' else lat,<EOL>'<STR_LIT>': - lon if lon_ref_info != '<STR_LIT:E>' else lon,<EOL>}<EOL><DEDENT><DEDENT><DEDENT>return simple<EOL>
Make a simplified version with common tags from raw EXIF data.