import copy


def copy_of_rule(origrule,attribute,newvalue):
    """
    Returns a copy of the origrule, where the given attribute
    is set to newvalue.
    """
    newrule=copy.copy(origrule)
    setattr(newrule,attribute,'%s' % newvalue)
    return newrule