import copy


def copy_node_for_user(user, node):
    """ Copy the ServerInfo object and change it's rest credentials to
    those of the use object. """
    nodecopy = copy.deepcopy(node)
    nodecopy.rest_username = user.username
    nodecopy.rest_password = user.password
    return nodecopy