<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def verify_socket(interface, pub_port, ret_port):
    '''
    Attempt to bind to the sockets to verify that they are available
    '''

    addr_family = lookup_family(interface)
    for port in pub_port, ret_port:
        sock = socket.socket(addr_family, socket.SOCK_STREAM)
        try:
            sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            sock.bind((interface, int(port)))
        except Exception as exc:
            msg = 'Unable to bind socket {0}:{1}'.format(interface, port)
            if exc.args:
                msg = '{0}, error: {1}'.format(msg, str(exc))
            else:
                msg = '{0}, this might not be a problem.'.format(msg)
            msg += '; Is there another salt-master running?'
            if is_console_configured():
                log.warning(msg)
            else:
                sys.stderr.write('WARNING: {0}\n'.format(msg))
            return False
        finally:
            sock.close()

    return True