def load_keys(filepath):
    """
    Loads the Twitter API keys into a dict.
    :param filepath: file path to config file with Twitter API keys.
    :return: keys_dict
    :raise: IOError
    """
    try:
        keys_file = open(filepath, 'rb')
        keys = {}
        for line in keys_file:
            key, value = line.split('=')
            keys[key.strip()] = value.strip()
    except IOError:
        message = ('File {} cannot be opened.'
                   ' Check that it exists and is binary.')
        print message.format(filepath)
        raise
    except:
        print "Error opening or unpickling file."
        raise
    return keys
