import re


def load_cows(filename):
    """
    Read the contents of the given file.  Assumes the file contents contain
    data in the form of comma-separated cow name, weight pairs, and return a
    dictionary containing cow names as keys and corresponding weights as values.

    Parameters:
    filename - the name of the data file as a string

    Returns:
    a dictionary of cow name (string), weight (int) pairs
    """

    file = open(filename)

    arr = re.split('[,\n]', file.read())

    file.close()

    cows = {}
    for i in range(0, len(arr), 2):
        cow_name = arr[i]
        cow_weight = arr[i + 1]
        cows[cow_name] = int(cow_weight)

    return cows