def parse_int(row, css, invalid_value):
    """Parses an int from the given row using the css selector. Returns
    invalid_value if there is no value."""

    result = row.css(css).get()
    if result:
        return int(result)
    return invalid_value