def METHOD_NAME(self, cr=None):
    """Create the labels for the socket."""
    self.label_layout = Gtk.DrawingArea().create_pango_layout('')
    self.label_layout.set_alignment(Pango.Alignment.CENTER)
    if cr:
        PangoCairo.update_layout(cr, self.label_layout)
    if self.domain in (Constants.GR_MESSAGE_DOMAIN, Constants.GR_STREAM_DOMAIN):
        self._line_width_factor = 1.0
    else:
        self._line_width_factor = 2.0
    self._update_colors()
    layout = self.label_layout
    layout.set_markup('<span font_desc="{font}">{name}</span>'.format(
        name=Utils.encode(self.name), font=Constants.PORT_FONT
    ))
    label_width, label_height = self.label_layout.get_size()
    self.width = 2 * Constants.PORT_LABEL_PADDING + label_width / Pango.SCALE
    self.height = (2 * Constants.PORT_LABEL_PADDING + label_height *
                   (3 if self.dtype == 'bus' else 1)) / Pango.SCALE
    self._label_layout_offsets = [0, Constants.PORT_LABEL_PADDING]
    self.height += self.height % 2  # uneven height