Extract the mac address from provided address. None is returned
    on error.
492995
def in6_addrtomac(addr):
    
    mask = inet_pton(socket.AF_INET6, "::ffff:ffff:ffff:ffff")
    x = in6_and(mask, inet_pton(socket.AF_INET6, addr))
    ifaceid = inet_ntop(socket.AF_INET6, x)[2:]
    return in6_ifaceidtomac(ifaceid)
1171586
def _validate_address(self, address):
        
        parsed = compat.urlparse(address)
        if not parsed.path:
            raise ValueError("Invalid {} address: {}".format(
                self.__class__.__name__, parsed))
        return parsed
1086199
public static Address from(String address) {
    int lastColon = address.lastIndexOf(':');
    int openBracket = address.indexOf('[');
    int closeBracket = address.indexOf(']');

    String host;
    if (openBracket != -1 && closeBracket != -1) {
      host = address.substring(openBracket + 1, closeBracket);
    } else if (lastColon != -1) {
      host = address.substring(0, lastColon);
    } else {
      host = address;
    }

    int port;
    if (lastColon != -1) {
      try {
        port = Integer.parseInt(address.substring(lastColon + 1));
      } catch (NumberFormatException e) {
        throw new MalformedAddressException(address, e);
      }
    } else {
      port = DEFAULT_PORT;
    }
    return new Address(host, port);
  }
1310044
def split_address(address):
    
    invalid = None, None

    if not address and address != 0:
        return invalid

    components = str(address).split(':')
    if len(components) > 2:
        return invalid

    if components[0] and not valid_hostname(components[0]):
        return invalid

    if len(components) == 2 and not valid_port(components[1]):
        return invalid

    if len(components) == 1:
        components.insert(0 if valid_port(components[0]) else 1, None)

    host, port = components
    port = int(port) if port else None

    return host, port
1218026
public static PathAddress parseCLIStyleAddress(String address) throws IllegalArgumentException {
        try {
            return PathAddress.parseCLIStyleAddress(address);
        } catch (NoSuchMethodError _nsme) {
            // jboss-as doesn't have parseCLIStyleAddress
            // Ignore the error and use the provided alternative
            return _parseCLIStyleAddress(address);
        }
    }
165560
def validateaddress(self, address: str) -> bool:
        ""

        try:
            Address.from_string(address, self.network_properties)
        except InvalidAddress:
            return False

        return True
1278642
def range_mac(mac_start, mac_end, step=1):
    """"""
    start = int(EUI(mac_start))
    end = int(EUI(mac_end))
    for i_mac in range(start, end, step):
        mac = EUI(int(EUI(i_mac)) + 1)
        ip = ['10'] + [str(int(i, 2)) for i in mac.bits().split('-')[-3:]]
        yield str(mac).replace('-', ':'), '.'.join(ip)
365262
def out_filter_get(self, address):
        

        func_name = 'neighbor.out_filter.get'
        param = {
            neighbors.IP_ADDRESS: address,
        }

        return call(func_name, **param)
883239
def _address_family(address):
    
    if address.startswith('[') and address.endswith(']'):
        return socket.AF_INET6
    for af in (socket.AF_INET, socket.AF_INET6):
        try:
            socket.inet_pton(af, address)
            return af
        except (ValueError, AttributeError, socket.error):
            continue
    return socket.AF_UNSPEC
856970
def get(self, mac):
        

        data = {
            self._FORMAT_F: 'json',
            self._SEARCH_F: mac
        }

        response = self.__decode_str(self.__call_api(self.__url, data), 'utf-8')

        if len(response) > 0:
            return self.__parse(response)
        raise EmptyResponseException()
1295497
function getAddress(addressInput) {
  var address = addressInput; // eslint-disable-line
  var result = null; // eslint-disable-line

  if (typeof(address) !== 'string') { throw new Error(`[ethjs-account] invalid address value ${JSON.stringify(address)} not a valid hex string`); }

  // Missing the 0x prefix
  if (address.substring(0, 2) !== '0x' &&
      address.substring(0, 2) !== 'XE') { address = `0x${address}`; }

  if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
    result = getChecksumAddress(address);

    // It is a checksummed address with a bad checksum
    if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
      throw new Error('[ethjs-account] invalid address checksum');
    }

  // Maybe ICAP? (we only support direct mode)
  } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
    throw new Error('[ethjs-account] ICAP and IBAN addresses, not supported yet..');

    /*
    // It is an ICAP address with a bad checksum
    if (address.substring(2, 4) !== ibanChecksum(address)) {
      throw new Error('invalid address icap checksum');
    }

    result = (new BN(address.substring(4), 36)).toString(16);
    while (result.length < 40) { result = '0' + result; }
    result = getChecksumAddress('0x' + result);
    */
  } else {
    throw new Error(`[ethjs-account] invalid address value ${JSON.stringify(address)} not a valid hex string`);
  }

  return result;
}
993560
def parse_group_address(addr):
    

    if addr is None:
        raise KNXException("No address given")

    res = None

    if re.match('[0-9]+$', addr):
        res = int(addr)

    match = re.match("([0-9]+)/([0-9]+)$", addr)
    if match:
        main = match.group(1)
        sub = match.group(2)
        res = int(main) * 2048 + int(sub)

    match = re.match("([0-9]+)/([0-9]+)/([0-9]+)$", addr)
    if match:
        main = match.group(1)
        middle = match.group(2)
        sub = match.group(3)
        res = int(main) * 256 * 8 + int(middle) * 256 + int(sub)

    if res is None:
        raise KNXException("Address {} does not match any address scheme".
                           format(addr))

    return res
20663
def get_derived_from(self, address):
    
    parent_address = self._derived_from_by_derivative.get(address, address)
    return self.get_target(parent_address)
562920
def mac_addr_info():
    
    mac = get_mac()
    if mac == get_mac():  # not random generated
        hexa = '%012x' % mac
        value = ':'.join(hexa[i:i+2] for i in range(0, 12, 2))
    else:
        value = None
    return {'mac': value}
1298628
def mac_address(ip):
    """"""
    mac = ''
    for line in os.popen('/sbin/ifconfig'):
        s = line.split()
        if len(s) > 3:
            if s[3] == 'HWaddr':
                mac = s[4]
            elif s[2] == ip:
                break
    return {'MAC': mac}
285533
def address_line_1(self):
        
        formalised_address = self.formalised_address
        if formalised_address is None:
            return
        try:
            address = formalised_address.split(',')
        except Exception as e:
            if self._debug:
                logging.error(
                    "Error getting address_line_1. Error message: " + e.args[0])
            return

        return address[0].strip()
1193087
def mac_address
      raise ::Fission::Error,"VM #{@name} does not exist" unless self.exists?

      line=File.new(vmx_path).grep(/^ethernet0.generatedAddress =/)
      if line.nil?
        #Fission.ui.output "Hmm, the vmx file #{vmx_path} does not contain a generated mac address "
        return nil
      end
      address=line.first.split("=")[1].strip.split(/\"/)[1]
      return address
    end