import socket
import errno


def check_port_is_available(host, port):
    """Check if a given port it's available

    Parameters
    ----------
    host : str
    port : int

    Returns
    -------
    available : bool

    """
    available = True
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        s.bind((host, port))
    except socket.error as error:
        if error.errno == errno.EADDRINUSE:
            available = False
    s.close()
    return available