def bitstring_to_bytes(s):
    """
    Function that converts a string composed by '1's and '0' to bytes

    :param s:
    :return:
    """
    return bytearray([int(s[i:i + 8], 2) for i in range(0, len(s), 8)])