def _create_instance(row):
    """
    Parse individual row of ARFF file in PHP dataset. If the row is from a
    tokens file, the first field must be a string of tokens optionally enclosed
    in single quotes. If the row is from a metrics file, it must be a comma-
    separated list of numbers. The last field must have values 'yes' or 'no,
    which are mapped to the integers 1 and 0, respectively.

    Args:
        row: String representing an individual row of an ARFF file in the PHP
            dataset.

    Returns:
        List of the form [features, label], where features is a list of
        features (tokens or metrics data) and label is an integer having the
        value 1 if the last field of the row is 'yes' and '0' otherwise.
    """

    assert row.count('\'') in [0,2]
    mod_row = row.split('\'');

    # Rows with multiple tokens are wrapped in single quote marks. Otherwise,
    # they are separated by commas.
    if row.count('\'') == 2:
        mod_row = row.split('\'')[1:];
    else:
        mod_row = row.split(',');

    assert (len(mod_row) == 2), "mod row: {}".format(mod_row)    
    return [mod_row[0].replace('\'', ''), 1 if 'yes' in mod_row[1] else 0]