def create_fmt(field_widths, keep_fields):
    """Given two lists: 1) the field widths 2) list with a 1 or 0 indicating whether or not to keep a field,
    create a fmt string

    Field Widths - https://docs.python.org/3.4/library/struct.html

    Format      C Type      Python Type         Standard Size
    x           pad byte    no value
    c           char        bytes of length 1   1
    s           char[]      bytes
    """
    keep_fields_pos_neg = [-1 if keep == 0 else keep for keep in keep_fields]
    field_widths_pos_neg = [fw*keep for fw, keep in zip(field_widths, keep_fields_pos_neg)]
    fmt_string = ''.join('{}{}'.format(abs(fw), 'x' if fw == 0 else 's')
                                              for fw in field_widths_pos_neg)

    return fmt_string