def get_code_cell_name(text):
    """Returns a code cell name from a code cell comment."""
    name = text.strip().lstrip("#% ")
    if name.startswith("<codecell>"):
        name = name[10:].lstrip()
    elif name.startswith("In["):
        name = name[2:]
        if name.endswith("]:"):
            name = name[:-1]
        name = name.strip()
    return name
Returns a code cell name from a code cell comment.