'Return a Member object based on a Node.
:param  node: Node object
:type   node: :class:`Node`
:keyword  balancer: The balancer the member is attached to.
:type     balancer: :class:`LoadBalancer`
:return:  Member object
:rtype:   :class:`Member`'

def _node_to_member(self, node, balancer):

    if hasattr(node, 'name'):
        member_id = node.name
    else:
        member_id = node
    if (hasattr(node, 'public_ips') and (len(node.public_ips) > 0)):
        member_ip = node.public_ips[0]
    else:
        member_ip = None
    extra = {'node': node}
    return Member(id=member_id, ip=member_ip, port=balancer.port, balancer=balancer, extra=extra)
