human
Complete the below
def copy_doc(doc, ignore_no_copy=True):

    ''''No_copy fields also get copied.'
    '''

=====
Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.
    import copy
    def remove_no_copy_fields(d):
        for df in d.meta.get(u'fields', {u'no_copy': 1}):
            if hasattr(d, df.fieldname):
                d.set(df.fieldname, None)
    fields_to_clear = [u'name', u'owner', u'creation', u'modified', u'modified_by']
    if (not local.flags.in_test):
        fields_to_clear.append(u'docstatus')
    if (not isinstance(doc, dict)):
        d = doc.as_dict()
    else:
        d = doc
    newdoc = get_doc(copy.deepcopy(d))
    newdoc.set(u'__islocal', 1)
    for fieldname in (fields_to_clear + [u'amended_from', u'amendment_date']):
        newdoc.set(fieldname, None)
    if (not ignore_no_copy):
        remove_no_copy_fields(newdoc)
    for (i, d) in enumerate(newdoc.get_all_children()):
        d.set(u'__islocal', 1)
        for fieldname in fields_to_clear:
            d.set(fieldname, None)
        if (not ignore_no_copy):
            remove_no_copy_fields(d)
    return newdoc