def camelcase_to_delimited(string, d='_', remove=None):
    """Convert string from CamelCase to delimiter_separated."""
    result = []
    for i, c in enumerate(string):
        if c.isupper():
            if i > 0:
                result.append(d)
        result.append(c.lower())
    result = ''.join(result)
    if remove and remove in result:
        remove = remove.lower()
        result = d.join([x for x in result.split(d) if x != remove])
    return result