def rmlinematch(oldstr, infile, dryrun=False):
    """
    Sed-like line deletion function based on given string..
    Usage: pysed.rmlinematch(<Unwanted string>, <Text File>)
    Example: pysed.rmlinematch('xyz', '/path/to/file.txt')
    Example:
    'DRYRUN': pysed.rmlinematch('xyz', '/path/to/file.txt', dryrun=True)
    This will dump the output to STDOUT instead of changing the input file.

    """

    linelist = []
    with open(infile) as reader:
        for item in reader:
            rmitem = re.match(r'.*{}'.format(oldstr), item)
            # if isinstance(rmitem) == isinstance(None):  Not quite sure the intent here
            if rmitem is None:
                linelist.append(item)
    if dryrun is False:
        with open(infile, "w") as writer:
            writer.truncate()
            for line in linelist:
                writer.writelines(line)
    elif dryrun is True:
        for line in linelist:
            print(line, end='')
    else:
        exit("""Unknown option specified to 'dryrun' argument,
              Usage: dryrun=<True|False>.""")