def parse_netloc(hostport):
    """
    Split a host-port production present in the URL into
    its constituent parts: host name/address string,
    and an optional integer port.

    Raises
    ------
    ValueError
        When host part is missing from the argument.
    """
    hostport = hostport.strip()
    port = None
    at = len(hostport)
    while 0 < at:
        at -= 1
        if not hostport[at].isdigit():
            break
    if hostport and 0 <= at and ':' == hostport[at]:
        host = hostport[:at].strip()
        if len(hostport) > at + 1:
            port = int(hostport[at + 1:]) 
    else:
        host = hostport
    if not host:
        raise ValueError(
            'Invalid host:port value: %s'
            % repr(hostport)
        )
    return host, port