def check_options(options):
    """ Check the options bitfield.

    Parameters
    ----------
    options : str

    Raises
    ------
    TypeError
        if options is not a string
    ValueError
        either if any character in option is not a zero or a one, or if options
        is not of length 8
    """
    if not isinstance(options, str):
        raise TypeError("'options' must be of type 'str', not '%s'" % type(
            options))
    elif not len(options) == 8 or not all(map(lambda x: x in ['0', '1'],
        iter(options))):
        raise ValueError(
            "'options' must be string of 0s and 1s of length 8, not '%s'" %
            options)
