def strip_magic(s):
    """Strip magic and comments from the beginning of a code cell

    Parameters
    ----------
    s : a code cell beginning with magic and/or comments

    """
    lines = s.split('\n')
    i = 0
    while True:
        line = lines[i]
        if not line or line.startswith('%%') or line.startswith('#'):
            i += 1
            continue
        else:
            break
    lines = lines[i:]
    s = '\n'.join(lines)
    return s
