'Return correctly formatted dpid from dpid or switch name (s1 -> 1)'

def defaultDpid(self, dpid=None):

    if dpid:
        dpid = dpid.translate(None, ':')
        assert ((len(dpid) <= self.dpidLen) and (int(dpid, 16) >= 0))
    else:
        nums = re.findall('\\d+', self.name)
        if nums:
            dpid = hex(int(nums[0]))[2:]
        else:
            raise Exception('Unable    to    derive    default    datapath    ID    -    please    either    specify    a    dpid    or    use    a    canonical    switch    name    such    as    s23.')
    return (('0' * (self.dpidLen - len(dpid))) + dpid)
