def parseAddressRange(text):
    """parse a single address or an address range and return a tuple."""
    if '-' in text:
        adr1, adr2 = text.split('-', 1)
        try:
            adr1 = int(adr1, 0)
        except ValueError:
            raise ValueError(
                'Address range start address must be a valid number in dec, hex or octal'
                )
        try:
            adr2 = int(adr2, 0)
        except ValueError:
            raise ValueError(
                'Address range end address must be a valid number in dec, hex or octal'
                )
        return adr1, adr2
    elif '/' in text:
        adr1, size = text.split('/', 1)
        try:
            adr1 = int(adr1, 0)
        except ValueError:
            raise ValueError(
                'Address range start address must be a valid number in dec, hex or octal'
                )
        multiplier = 1
        if size.endswith('k'):
            size = size[:-1]
            multiplier = 1024
        try:
            size = int(size, 0) * multiplier
        except ValueError:
            raise ValueError(
                'Address range size must be a valid number in dec, hex or octal'
                )
        return adr1, adr1 + size - 1
    else:
        try:
            adr = int(text, 0)
            return adr, None
        except ValueError:
            raise ValueError(
                'Address must be a valid number in dec, hex or octal or a range adr1-adr2'
                )
