Instruction:
Can you generate a brief explanation for the following Python 3 code
def database_set_visibility(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Sets the visibility of the object.


Instruction:
How would you explain what the following Python 3 function does
def database_list_folder(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/listFolder' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: List the folder of a database.


Instruction:
Here you have a function in Python 3, explain what it does
def file_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Add tags to a file.


Instruction:
Write a Python 3 function that can
add types to a file.

Response:
def file_add_types(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /file-xxxx/addTypes API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes
    """
    return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you implement a function in Python 3 that
invokes the /file-xxxx/close API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Files#API-method%3A-%2Ffile-xxxx%2Fclose

Response:
def file_close(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /file-xxxx/close API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Files#API-method%3A-%2Ffile-xxxx%2Fclose
    """
    return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you implement a function in Python 3 that
invokes the /file-xxxx/describe API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Files#API-method%3A-%2Ffile-xxxx%2Fdescribe

Response:
def file_describe(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /file-xxxx/describe API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Files#API-method%3A-%2Ffile-xxxx%2Fdescribe
    """
    return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Given the following Python 3 function, write the documentation
def file_download(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/download' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Downloads a file from the specified object.


Instruction:
Write a Python 3 function that can
get details of a file.

Response:
def file_get_details(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /file-xxxx/getDetails API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails
    """
    return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
How would you explain what the following Python 3 function does
def file_list_projects(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: List all projects in a file.


Instruction:
Here you have a function in Python 3, explain what it does
def file_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Remove tags from a file.


Instruction:
How would you implement a function in Python 3 that
removes types from a file.

Response:
def file_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /file-xxxx/removeTypes API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
    """
    return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you generate a brief explanation for the following Python 3 code
def file_rename(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Rename a file in a node.


Instruction:
Make a summary of the following Python 3 code
def file_set_details(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Sets the details of a file.


Instruction:
Can you generate the documentation for the following Python 3 function
def file_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Sets the properties of a file.


Instruction:
Write a Python 3 function for
setting the visibility of a file.

Response:
def file_set_visibility(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /file-xxxx/setVisibility API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility
    """
    return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
How would you explain what the following Python 3 function does
def file_upload(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/upload' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Upload a file to the object identified by object_id.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def file_new(input_params={}, always_retry=True, **kwargs):
    input_params_cp = Nonce.update_nonce(input_params)
    return DXHTTPRequest('/file/new', input_params_cp, always_retry=always_retry, **kwargs)

Response: This method is used to invoke the file new API method.


Instruction:
Here you have a function in Python 3, explain what it does
def global_workflow_add_authorized_users(name_or_id, alias=None, input_params={}, always_retry=True, **kwargs):
    fully_qualified_version = name_or_id + (('/' + alias) if alias else '')
    return DXHTTPRequest('/%s/addAuthorizedUsers' % fully_qualified_version, input_params, always_retry=always_retry, **kwargs)

Response: Add authorized users to a global workflow.


Instruction:
Implement a Python 3 function for
invoking the /globalworkflow-xxxx/run API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Global-Workflows#API-method:-/globalworkflow-xxxx%5B/yyyy%5D/run

Response:
def global_workflow_run(name_or_id, alias=None, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /globalworkflow-xxxx/run API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Global-Workflows#API-method:-/globalworkflow-xxxx%5B/yyyy%5D/run
    """
    input_params_cp = Nonce.update_nonce(input_params)
    fully_qualified_version = name_or_id + (('/' + alias) if alias else '')
    return DXHTTPRequest('/%s/run' % fully_qualified_version, input_params_cp, always_retry=always_retry, **kwargs)


Instruction:
How would you code a function in Python 3 to
add tags to a node in a cluster.

Response:
def job_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /job-xxxx/addTags API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Applets-and-Entry-Points#API-method%3A-%2Fjob-xxxx%2FaddTags
    """
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Write a Python 3 script for
describing a single job.

Response:
def job_describe(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /job-xxxx/describe API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Applets-and-Entry-Points#API-method%3A-%2Fjob-xxxx%2Fdescribe
    """
    return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you tell what is the following Python 3 function doing
def job_get_log(object_id, input_params={}, always_retry=False, **kwargs):
    return DXHTTPRequest('/%s/getLog' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Get the log of a job.


Instruction:
Given the following Python 3 function, write the documentation
def job_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Remove tags from a node in a cluster.


Instruction:
Can you generate the documentation for the following Python 3 function
def job_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Set properties of a job.


Instruction:
Make a summary of the following Python 3 code
def job_terminate(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/terminate' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Terminate the current job.


Instruction:
Create a Python 3 function for
returning a single object representing the current notifications.

Response:
def notifications_get(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /notifications/get API method.
    """
    return DXHTTPRequest('/notifications/get', input_params, always_retry=always_retry, **kwargs)


Instruction:
How would you explain what the following Python 3 function does
def notifications_mark_read(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/notifications/markRead', input_params, always_retry=always_retry, **kwargs)

Response: Mark read notifications for a node in a tree.


Instruction:
Create a Python 3 function to
invoke the /org-xxxx/describe API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Organizations#API-method%3A-%2Forg-xxxx%2Fdescribe

Response:
def org_describe(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /org-xxxx/describe API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Organizations#API-method%3A-%2Forg-xxxx%2Fdescribe
    """
    return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Create a Python 3 function to
get the list of members of a node in the order they were assigned.

Response:
def org_find_members(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /org-xxxx/findMembers API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Organizations#API-method%3A-%2Forg-xxxx%2FfindMembers
    """
    return DXHTTPRequest('/%s/findMembers' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Write a Python 3 script to
get a list of projects in the organization.

Response:
def org_find_projects(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /org-xxxx/findProjects API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Organizations#API-method%3A-%2Forg-xxxx%2FfindProjects
    """
    return DXHTTPRequest('/%s/findProjects' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you tell what is the following Python 3 function doing
def org_find_apps(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/findApps' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Get a list of apps in the organization.


Instruction:
Can you generate the documentation for the following Python 3 function
def org_invite(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/invite' % object_id, input_params, always_retry=always_retry, **kwargs)

Response:
Invokes the /org-xxxx/invite API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Organizations#API-method%3A-%2Forg-xxxx%2Finvite


Instruction:
Given the following Python 3 function, write the documentation
def org_remove_member(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/removeMember' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Remove a member from the object.


Instruction:
Can you create a Python 3 function that
sets the member access of the object.

Response:
def org_set_member_access(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /org-xxxx/setMemberAccess API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Organizations#API-method%3A-%2Forg-xxxx%2FsetMemberAccess
    """
    return DXHTTPRequest('/%s/setMemberAccess' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Here you have a function in Python 3, explain what it does
def org_update(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Update the object with the given object_id.


Instruction:
Can you write a function in Python 3 where it
adds tags to a node in a node s tree.

Response:
def project_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /project-xxxx/addTags API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject-xxxx%2FaddTags
    """
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Make a summary of the following Python 3 code
def project_clone(object_id, input_params={}, always_retry=False, **kwargs):
    return DXHTTPRequest('/%s/clone' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Clones a node in the cluster.


Instruction:
Make a summary of the following Python 3 code
def project_decrease_permissions(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/decreasePermissions' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Decrease permissions of a node in a cluster.


Instruction:
Given the following Python 3 function, write the documentation
def project_describe(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Describe a single project.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def project_destroy(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/destroy' % object_id, input_params, always_retry=always_retry, **kwargs)

Response:
Invokes the /project-xxxx/destroy API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject-xxxx%2Fdestroy


Instruction:
Write a Python 3 script for
invoking the /project-xxxx/invite API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Project-Permissions-and-Sharing#API-method%3A-%2Fproject-xxxx%2Finvite

Response:
def project_invite(object_id, input_params={}, always_retry=False, **kwargs):
    """
    Invokes the /project-xxxx/invite API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Project-Permissions-and-Sharing#API-method%3A-%2Fproject-xxxx%2Finvite
    """
    return DXHTTPRequest('/%s/invite' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you generate the documentation for the following Python 3 function
def project_leave(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/leave' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Delete a node from the project.


Instruction:
How would you explain what the following Python 3 function does
def project_list_folder(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/listFolder' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: List the contents of a folder in the project.


Instruction:
Make a summary of the following Python 3 code
def project_move(object_id, input_params={}, always_retry=False, **kwargs):
    return DXHTTPRequest('/%s/move' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Moves the current project to the next available project.


Instruction:
Write a Python 3 script to
create a new folder on the project.

Response:
def project_new_folder(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /project-xxxx/newFolder API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Folders-and-Deletion#API-method%3A-%2Fclass-xxxx%2FnewFolder
    """
    return DXHTTPRequest('/%s/newFolder' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Make a summary of the following Python 3 code
def project_remove_folder(object_id, input_params={}, always_retry=False, **kwargs):
    return DXHTTPRequest('/%s/removeFolder' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Remove a folder from the project.


Instruction:
Given the following Python 3 function, write the documentation
def project_remove_objects(object_id, input_params={}, always_retry=False, **kwargs):
    return DXHTTPRequest('/%s/removeObjects' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Remove objects from a node in the current project.


Instruction:
Can you implement a function in Python 3 that
removes tags from a node in a cluster.

Response:
def project_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /project-xxxx/removeTags API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject-xxxx%2FremoveTags
    """
    return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you implement a function in Python 3 that
invokes the /project-xxxx/renameFolder API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Folders-and-Deletion#API-method%3A-%2Fclass-xxxx%2FrenameFolder

Response:
def project_rename_folder(object_id, input_params={}, always_retry=False, **kwargs):
    """
    Invokes the /project-xxxx/renameFolder API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Folders-and-Deletion#API-method%3A-%2Fclass-xxxx%2FrenameFolder
    """
    return DXHTTPRequest('/%s/renameFolder' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Implement a Python 3 function for
setting properties of a project.

Response:
def project_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /project-xxxx/setProperties API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject-xxxx%2FsetProperties
    """
    return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you write a function in Python 3 where it
gets a single object from the DNA Transfer API.

Response:
def project_transfer(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /project-xxxx/transfer API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Project-Permissions-and-Sharing#API-method%3A-%2Fproject-xxxx%2Ftransfer
    """
    return DXHTTPRequest('/%s/transfer' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
How would you explain what the following Python 3 function does
def project_update(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Update the project with the given object_id.


Instruction:
How would you code a function in Python 3 to
update the sponsorship of a project.

Response:
def project_update_sponsorship(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /project-xxxx/updateSponsorship API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject-xxxx%2FupdateSponsorship
    """
    return DXHTTPRequest('/%s/updateSponsorship' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Create a Python 3 function to
create a new project.

Response:
def project_new(input_params={}, always_retry=False, **kwargs):
    """
    Invokes the /project/new API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject%2Fnew
    """
    return DXHTTPRequest('/project/new', input_params, always_retry=always_retry, **kwargs)


Instruction:
Create a Python 3 function for
adding tags to a node.

Response:
def record_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /record-xxxx/addTags API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags
    """
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Write a Python 3 function that can
add types to a node.

Response:
def record_add_types(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /record-xxxx/addTypes API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes
    """
    return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you generate a brief explanation for the following Python 3 code
def record_close(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Close the object with the given object_id.


Instruction:
Write a Python 3 function for
invoking the /record-xxxx/describe API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Records#API-method%3A-%2Frecord-xxxx%2Fdescribe

Response:
def record_describe(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /record-xxxx/describe API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Records#API-method%3A-%2Frecord-xxxx%2Fdescribe
    """
    return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Explain what the following Python 3 code does
def record_get_details(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Get details for a record.


Instruction:
Explain what the following Python 3 code does
def record_list_projects(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Get a list of all projects in the object.


Instruction:
How would you explain what the following Python 3 function does
def record_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Remove tags from a node.


Instruction:
How would you code a function in Python 3 to
remove types from a node in the cluster.

Response:
def record_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /record-xxxx/removeTypes API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
    """
    return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Make a summary of the following Python 3 code
def record_rename(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Rename an object in the current object.


Instruction:
Make a summary of the following Python 3 code
def record_set_details(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Record the details of a single object.


Instruction:
How would you explain what the following Python 3 function does
def record_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Sets properties of a record.


Instruction:
Can you generate the documentation for the following Python 3 function
def record_set_visibility(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Sets the visibility of the object.


Instruction:
Can you tell what is the following Python 3 function doing
def system_describe_data_objects(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/describeDataObjects', input_params, always_retry=always_retry, **kwargs)

Response: Get the details of all data objects in the current node.


Instruction:
Write a Python 3 function for
getting the list of executions for the current node.

Response:
def system_describe_executions(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/describeExecutions API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeExecutions
    """
    return DXHTTPRequest('/system/describeExecutions', input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you tell what is the following Python 3 function doing
def system_describe_projects(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/describeProjects', input_params, always_retry=always_retry, **kwargs)

Response: Get the list of projects in the current node.


Instruction:
How would you explain what the following Python 3 function does
def system_find_affiliates(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/findAffiliates', input_params, always_retry=always_retry, **kwargs)

Response: Retrieves the list of all affiliates in the current node.


Instruction:
Make a summary of the following Python 3 code
def system_find_apps(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/findApps', input_params, always_retry=always_retry, **kwargs)

Response: Retrieves the list of apps in the current node.


Instruction:
Write a Python 3 function for
retrieving the data objects in the current node.

Response:
def system_find_data_objects(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/findDataObjects API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDataObjects
    """
    return DXHTTPRequest('/system/findDataObjects', input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you generate a brief explanation for the following Python 3 code
def system_find_global_workflows(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/findGlobalWorkflows', input_params, always_retry=always_retry, **kwargs)

Response: Retrieves the global workflows for a single virtual machine.


Instruction:
How would you explain what the following Python 3 function does
def system_resolve_data_objects(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/resolveDataObjects', input_params, always_retry=always_retry, **kwargs)

Response: Invoke the system resolve data objects API method.


Instruction:
Create a Python 3 function to
retrieve the list of executions for the current node in the cluster.

Response:
def system_find_executions(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/findExecutions API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindExecutions
    """
    return DXHTTPRequest('/system/findExecutions', input_params, always_retry=always_retry, **kwargs)


Instruction:
Make a summary of the following Python 3 code
def system_find_analyses(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/findAnalyses', input_params, always_retry=always_retry, **kwargs)

Response: Retrieves the list of analyses in the current node.


Instruction:
Can you generate the documentation for the following Python 3 function
def system_find_databases(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/findDatabases', input_params, always_retry=always_retry, **kwargs)

Response: Retrieves the list of databases in the current node.


Instruction:
Implement a Python 3 function for
invoking the /system/findJobs API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindJobs

Response:
def system_find_jobs(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/findJobs API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindJobs
    """
    return DXHTTPRequest('/system/findJobs', input_params, always_retry=always_retry, **kwargs)


Instruction:
How would you code a function in Python 3 to
retrieve the list of projects in the current node.

Response:
def system_find_projects(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/findProjects API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindProjects
    """
    return DXHTTPRequest('/system/findProjects', input_params, always_retry=always_retry, **kwargs)


Instruction:
Write a Python 3 script to
invoke the /system/findUsers API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindUsers

Response:
def system_find_users(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/findUsers API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindUsers
    """
    return DXHTTPRequest('/system/findUsers', input_params, always_retry=always_retry, **kwargs)


Instruction:
Make a summary of the following Python 3 code
def system_find_project_members(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/findProjectMembers', input_params, always_retry=always_retry, **kwargs)

Response: Retrieves the project members of the current node.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def system_find_orgs(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/findOrgs', input_params, always_retry=always_retry, **kwargs)

Response: Get the list of ORGS available in the current user s account.


Instruction:
Implement a function in Python 3 to
create a request to generate batch inputs for the current node.

Response:
def system_generate_batch_inputs(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/generateBatchInputs API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/generateBatchInputs
    """
    return DXHTTPRequest('/system/generateBatchInputs', input_params, always_retry=always_retry, **kwargs)


Instruction:
Implement a function in Python 3 to
return a request object that will execute the system global search API.

Response:
def system_global_search(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/globalSearch API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/globalSearch
    """
    return DXHTTPRequest('/system/globalSearch', input_params, always_retry=always_retry, **kwargs)


Instruction:
Write a Python 3 function that can
greet a single node from the system.

Response:
def system_greet(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/greet API method.
    """
    return DXHTTPRequest('/system/greet', input_params, always_retry=always_retry, **kwargs)


Instruction:
Write a Python 3 function for
returning a request object that can be used to retrieve the headers for a single node.

Response:
def system_headers(input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /system/headers API method.
    """
    return DXHTTPRequest('/system/headers', input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you generate the documentation for the following Python 3 function
def system_shorten_url(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/shortenURL', input_params, always_retry=always_retry, **kwargs)

Response: shorten the URL of a node in a tree.


Instruction:
Given the following Python 3 function, write the documentation
def system_whoami(input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/system/whoami', input_params, always_retry=always_retry, **kwargs)

Response: This method is used to invoke the system whoami API method.


Instruction:
How would you code a function in Python 3 to
retrieve the user s detailed information.

Response:
def user_describe(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /user-xxxx/describe API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fdescribe
    """
    return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Implement a Python 3 function for
updating the user s current state.

Response:
def user_update(object_id, input_params={}, always_retry=False, **kwargs):
    """
    Invokes the /user-xxxx/update API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fupdate
    """
    return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Explain what the following Python 3 code does
def workflow_add_stage(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/addStage' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Adds a stage to the current object.


Instruction:
Can you implement a function in Python 3 that
adds tags to a node in the current node.

Response:
def workflow_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/addTags API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags
    """
    return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you tell what is the following Python 3 function doing
def workflow_add_types(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Adds types to a node in the order they appear in the object.


Instruction:
Make a summary of the following Python 3 code
def workflow_close(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Closes a single object in the cluster.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def workflow_describe(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Describe the current state of a single object.


Instruction:
Write a Python 3 function that can
dry run a single workflow.

Response:
def workflow_dry_run(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/dryRun API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FdryRun
    """
    return DXHTTPRequest('/%s/dryRun' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Create a Python 3 function to
get details of a specific object.

Response:
def workflow_get_details(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/getDetails API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails
    """
    return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you implement a function in Python 3 that
returns a request to check if a workflow is stage compatible with the current state of the current stage.

Response:
def workflow_is_stage_compatible(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/isStageCompatible API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FisStageCompatible
    """
    return DXHTTPRequest('/%s/isStageCompatible' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you generate a brief explanation for the following Python 3 code
def workflow_list_projects(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: List the projects in the object.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def workflow_move_stage(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/moveStage' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Moves the current stage of the object to the next stage.


Instruction:
Implement a function in Python 3 to
overwrite the specified object with the current state of the current state of the current state of the current state of the current state of the current state of the current state of the current state.

Response:
def workflow_overwrite(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/overwrite API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Foverwrite
    """
    return DXHTTPRequest('/%s/overwrite' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you implement a function in Python 3 that
removes a stage from the current object.

Response:
def workflow_remove_stage(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/removeStage API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FremoveStage
    """
    return DXHTTPRequest('/%s/removeStage' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you tell what is the following Python 3 function doing
def workflow_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Removes tags from a node in a node s sequence.


Instruction:
Can you tell what is the following Python 3 function doing
def workflow_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Remove types from a node in the cluster.


Instruction:
Make a summary of the following Python 3 code
def workflow_rename(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Rename an object in the current object.


Instruction:
Write a Python 3 script for
validating a batch of objects.

Response:
def workflow_validate_batch(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/validateBatch API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FvalidateBatch
    """
    return DXHTTPRequest('/%s/validateBatch' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
How would you implement a function in Python 3 that
invokes the /workflow-xxxx/setDetails API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails

Response:
def workflow_set_details(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/setDetails API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails
    """
    return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
How would you implement a function in Python 3 that
sets properties of a node in a node s hierarchy.

Response:
def workflow_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/setProperties API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties
    """
    return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Write a Python 3 function that can
set the stage inputs for the object.

Response:
def workflow_set_stage_inputs(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/setStageInputs API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FsetStageInputs
    """
    return DXHTTPRequest('/%s/setStageInputs' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you generate the documentation for the following Python 3 function
def workflow_set_visibility(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: Sets the visibility of the object in the cluster.


Instruction:
How would you code a function in Python 3 to
update the object with the given object_id.

Response:
def workflow_update(object_id, input_params={}, always_retry=True, **kwargs):
    """
    Invokes the /workflow-xxxx/update API method.

    For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fupdate
    """
    return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs)


Instruction:
Can you generate the documentation for the following Python 3 function
def workflow_update_stage_executable(object_id, input_params={}, always_retry=True, **kwargs):
    return DXHTTPRequest('/%s/updateStageExecutable' % object_id, input_params, always_retry=always_retry, **kwargs)

Response: This method is used to invoke the workflow -xxxx update stage executable API method.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def _image_to_data(img):
    # If the image is already encoded in Base64, we have nothing to do here
    if "src" not in img.attrs or img["src"].startswith("data:"):
        return
    elif re.match("https?://", img["src"]):
        img_data = _load_url(img["src"]).read()
    else:
        img_data = _load_file(img["src"]).read()
    img_type = imghdr.what("", img_data)
    img_b64 = base64.b64encode(img_data)
    src_data = "data:image/none;base64,"
    if img_type:
        src_data = "data:image/{};base64,{}".format(img_type, img_b64)
    img["src"] = src_data

Response: Does the work of encoding an image into Base64


Instruction:
Given the following Python 3 function, write the documentation
def _bake_css(link):
    if "href" in link.attrs and (re.search("\.css$", link["href"])) or ("rel" in link.attrs and link["rel"] is "stylesheet") or ("type" in link.attrs and link["type"] is "text/css"):
        if re.match("https?://", link["href"]):
            css_data = _load_url(link["href"]).read()
        else:
            css_data = _load_file(link["href"]).read()
        link.clear()
        if USING_PYTHON2:
            link.string = css_data
        else:
            link.string = str(css_data)
        link.name = "style"
        del link["rel"]
        del link["href"]

Response: Takes a link element and turns it into an inline style link if applicable


Instruction:
Implement a function in Python 3 to
bake a script element and only if it contains a remote resource

Response:
def _bake_script(script):
    """
    Takes a script element and bakes it in only if it contains a remote resource
    """
    if "src" in script.attrs:
        if re.match("https?://", script["src"]):
            script_data = _load_url(script["src"]).read()
        else:
            script_data = _load_file(script["src"]).read()
        script.clear()
        if USING_PYTHON2:
            script.string = "\n" + script_data + "\n"
        else:
            script.string = "\n" + str(script_data) + "\n"
        del script["src"]
        del script["type"]


Instruction:
Can you write a function in Python 3 where it
loads a file from the local filesystem

Response:
def _load_file(path):
    """
    Loads a file from the local filesystem
    """
    if not os.path.exists(path):
        parser.error("{} was not found!".format(path))
    if USING_PYTHON2:
        mode = "r"
    else:
        mode = "rb"
    try:
        f = open(path, mode)
        return f
    except IOError as ex:
        parser.error("{path} could not be read due to an I/O error! ({ex})".format(path=path, ex=ex))


Instruction:
Implement a Python 3 function for
loading a URL resource from a remote server

Response:
def _load_url(url):
    """
    Loads a URL resource from a remote server
    """
    try:
        response = requests.get(url)
        return BytesIO(response.content)
    except IOError as ex:
        parser.error("{url} could not be loaded remotely! ({ex})".format(url=url, ex=ex))


Instruction:
Here you have a function in Python 3, explain what it does
def bake(src):
    src = os.path.realpath(src)
    path = os.path.dirname(src)
    filename = os.path.basename(src)
    html = _load_file(src).read()
    if imghdr.what("", html):
        html = "".format(cgi.escape(filename))

    # Change to the file's directory so image files with relative paths can be loaded correctly
    cwd = os.getcwd()
    os.chdir(path)
    bs_html = bs4.BeautifulSoup(html, "html.parser")
    images = bs_html.find_all("img")
    for image in images:
        _image_to_data(image)
    for link in bs_html.find_all("link"):
        _bake_css(link)
    for script in bs_html.find_all("script"):
        _bake_script(script)
    os.chdir(cwd)
    return bs_html

Response: Runs the encoder on the given source file


Instruction:
Can you write a function in Python 3 where it
uploads the HTML to the server and returns the ID of the uploaded file.

Response:
def upload_html(destination, html, name=None):
    """
    Uploads the HTML to a file on the server
    """
    [project, path, n] = parse_destination(destination)
    try:
        dxfile = dxpy.upload_string(html, media_type="text/html", project=project, folder=path, hidden=True, name=name or None)
        return dxfile.get_id()
    except dxpy.DXAPIError as ex:
        parser.error("Could not upload HTML report to DNAnexus server! ({ex})".format(ex=ex))


Instruction:
Can you generate a brief explanation for the following Python 3 code
def create_record(destination, file_ids, width=None, height=None):
    [project, path, name] = parse_destination(destination)
    files = [dxpy.dxlink(file_id) for file_id in file_ids]
    details = {"files": files}
    if width:
        details["width"] = width
    if height:
        details["height"] = height
    try:
        dxrecord = dxpy.new_dxrecord(project=project, folder=path, types=["Report", "HTMLReport"], details=details, name=name)
        dxrecord.close()
        return dxrecord.get_id()
    except dxpy.DXAPIError as ex:
        parser.error("Could not create an HTML report record on DNAnexus servers! ({ex})".format(ex=ex))

Response: Creates a master record for the HTML report.


Instruction:
Can you generate a brief explanation for the following Python 3 code
def save(filename, html):
    try:
        out_file = open(filename, "w")
        out_file.write(html)
        out_file.close()
    except IOError as ex:
        parser.error("Could not write baked HTML to local file {name}. ({ex})".format(name=filename, ex=ex))

Response: Saves the HTML to a local file.


Instruction:
Create a Python 3 function for
formatting a byte size as a string.

Response:
def get_size_str(size):
    """
    Formats a byte size as a string.

    The returned string is no more than 9 characters long.
    """
    if size == 0:
        magnitude = 0
        level = 0
    else:
        magnitude = math.floor(math.log(size, 10))
        level = int(min(math.floor(magnitude // 3), 4))
    return ('%d' if level == 0 else '%.2f') % (float(size) / 2**(level*10)) + ' ' + SIZE_LEVEL[level]


Instruction:
Create a Python 3 function to
check if a thing is a job - based object reference

Response:
def is_job_ref(thing, reftype=dict):
    '''
    :param thing: something that might be a job-based object reference hash
    :param reftype: type that a job-based object reference would be (default is dict)
    '''
    return isinstance(thing, reftype) and \
        ((len(thing) == 2 and \
              isinstance(thing.get('field'), basestring) and \
              isinstance(thing.get('job'), basestring)) or \
             (len(thing) == 1 and \
                  isinstance(thing.get('$dnanexus_link'), reftype) and \
                  isinstance(thing['$dnanexus_link'].get('field'), basestring) and \
                  isinstance(thing['$dnanexus_link'].get('job'), basestring)))


Instruction:
Write a Python 3 function for
printing the description of a DNAnexus entity.

Response:
def print_desc(desc, verbose=False):
    '''
    :param desc: The describe hash of a DNAnexus entity
    :type desc: dict

    Depending on the class of the entity, this method will print a
    formatted and human-readable string containing the data in *desc*.
    '''
    if desc['class'] in ['project', 'workspace', 'container']:
        print_project_desc(desc, verbose=verbose)
    elif desc['class'] == 'app':
        print_app_desc(desc, verbose=verbose)
    elif desc['class'] == 'globalworkflow':
        print_globalworkflow_desc(desc, verbose=verbose)
    elif desc['class'] in ['job', 'analysis']:
        print_execution_desc(desc)
    elif desc['class'] == 'user':
        print_user_desc(desc)
    elif desc['class'] in ['org', 'team']:
        print_generic_desc(desc)
    else:
        print_data_obj_desc(desc, verbose=verbose)


Instruction:
Write a Python 3 script for
returning a string representation of the given ls - l - desc.

Response:
def get_ls_l_desc(desc, include_folder=False, include_project=False):
    """
    desc must have at least all the fields given by get_ls_l_desc_fields.
    """
    # If you make this method consume an additional field, you must add it to
    # get_ls_l_desc_fields above.
    if 'state' in desc:
        state_len = len(desc['state'])
        if desc['state'] != 'closed':
            state_str = YELLOW() + desc['state'] + ENDC()
        else:
            state_str = GREEN() + desc['state'] + ENDC()
    else:
        state_str = ''
        state_len = 0

    name_str = ''
    if include_folder:
        name_str += desc['folder'] + ('/' if desc['folder'] != '/' else '')

    name_str += desc['name']

    if desc['class'] in ['applet', 'workflow']:
        name_str = BOLD() + GREEN() + name_str + ENDC()

    size_str = ''
    if 'size' in desc and desc['class'] == 'file':
        size_str = get_size_str(desc['size'])
    elif 'length' in desc:
        size_str = str(desc['length']) + ' rows'
    size_padding = ' ' * max(0, 9 - len(size_str))

    return (state_str +
            DELIMITER(' '*(8 - state_len)) + render_short_timestamp(desc['modified']) +
            DELIMITER(' ') + size_str +
            DELIMITER(size_padding + ' ') + name_str +
            DELIMITER(' (') + ((desc['project'] + DELIMITER(':')) if include_project else '') + desc['id'] +
            DELIMITER(')'))


Instruction:
Explain what the following Python 3 code does
def get_find_executions_string(desc, has_children, single_result=False, show_outputs=True,
                               is_cached_result=False):
    '''
    :param desc: hash of execution's describe output
    :param has_children: whether the execution has children to be printed
    :param single_result: whether the execution is displayed as a single result or as part of an execution tree
    :param is_cached_result: whether the execution should be formatted as a cached result
    '''
    is_not_subjob = desc['parentJob'] is None or desc['class'] == 'analysis' or single_result
    result = ("* " if is_not_subjob and get_delimiter() is None else "")
    canonical_execution_name = desc['executableName']
    if desc['class'] == 'job':
        canonical_execution_name += ":" + desc['function']
    execution_name = desc.get('name', '<no name>')

    # Format the name of the execution
    if is_cached_result:
        result += BOLD() + "[" + ENDC()
    result += BOLD() + BLUE()
    if desc['class'] == 'analysis':
        result += UNDERLINE()
    result += execution_name + ENDC()

    if execution_name != canonical_execution_name and execution_name+":main" != canonical_execution_name:
        result += ' (' + canonical_execution_name + ')'

    if is_cached_result:
        result += BOLD() + "]" + ENDC()

    # Format state
    result += DELIMITER(' (') + JOB_STATES(desc['state']) + DELIMITER(') ') + desc['id']

    # Add unicode pipe to child if necessary
    result += DELIMITER('\n' + (u'│ ' if is_not_subjob and has_children else ("  " if is_not_subjob else "")))
    result += desc['launchedBy'][5:] + DELIMITER(' ')
    result += render_short_timestamp(desc['created'])

    cached_and_runtime_strs = []

    if is_cached_result:
        cached_and_runtime_strs.append(YELLOW() + "cached" + ENDC())

    if desc['class'] == 'job':
        # Only print runtime if it ever started running
        if desc.get('startedRunning'):
            if desc['state'] in ['done', 'failed', 'terminated', 'waiting_on_output']:
                runtime = datetime.timedelta(seconds=int(desc['stoppedRunning']-desc['startedRunning'])//1000)
                cached_and_runtime_strs.append("runtime " + str(runtime))
            elif desc['state'] == 'running':
                seconds_running = max(int(time.time()-desc['startedRunning']//1000), 0)
                msg = "running for {rt}".format(rt=datetime.timedelta(seconds=seconds_running))
                cached_and_runtime_strs.append(msg)

    if cached_and_runtime_strs:
        result += " (" + ", ".join(cached_and_runtime_strs) + ")"

    if show_outputs:
        prefix = DELIMITER('\n' + (u'│ ' if is_not_subjob and has_children else ("  " if is_not_subjob else "")))
        if desc.get("output") != None:
            result += job_output_to_str(desc['output'], prefix=prefix)
        elif desc['state'] == 'failed' and 'failureReason' in desc:
            result += prefix + BOLD() + desc['failureReason'] + ENDC() + ": " + fill(desc.get('failureMessage', ''),
                                                                                subsequent_indent=prefix.lstrip('\n'))

    return result

Response: Return a string that can be used to find the executions of the given execution.


Instruction:
Can you tell what is the following Python 3 function doing
def from_instance_count(cls, instance_count_arg, entrypoint="*"):
        try:
            if instance_count_arg is None:
                return cls(None)
            if isinstance(instance_count_arg, basestring) or isinstance(instance_count_arg, int):
                return cls({entrypoint: {"clusterSpec": {"initialInstanceCount": int(instance_count_arg)}}})
            if isinstance(instance_count_arg, dict):
                return cls({k: {"clusterSpec": {"initialInstanceCount": int(v)}} for k, v in instance_count_arg.items()})
            raise ValueError
        except ValueError:
            DXError('Expected instance_count field to be either an int, string or a dict')

Response:
Returns a SystemRequirementsDict that can be passed as a
        input to job or new or run API calls.


Instruction:
Given the following Python 3 function, write the documentation
def from_instance_type(cls, instance_type_arg, entrypoint="*"):
        if instance_type_arg is None:
            return cls(None)
        if isinstance(instance_type_arg, basestring):
            # By default, all entry points ("*") should use this instance type
            return cls({entrypoint: {"instanceType": instance_type_arg}})
        if isinstance(instance_type_arg, dict):
            # instance_type is a map of entry point to instance type
            return cls({fn: {"instanceType": fn_inst} for fn, fn_inst in instance_type_arg.items()})
        raise DXError('Expected instance_type field to be either a string or a dict')

Response:
Returns a SystemRequirementsDict that can be passed as a
        input to job or new or run API calls.


Instruction:
Write a Python 3 script for
creating a SystemRequirementsDict encapsulating system requirements.

Response:
def from_sys_requirements(cls, system_requirements, _type='all'):
        """
        Returns SystemRequirementsDict encapsulating system requirements.
        It can extract only entrypoints with specific fields ('clusterSpec',
        'instanceType', etc), depending on the value of _type.
        """
        if _type not in ('all', 'clusterSpec', 'instanceType'):
            raise DXError("Expected '_type' to be either 'all', 'clusterSpec', or 'instanceType'")

        if _type == 'all':
            return cls(system_requirements)

        extracted = defaultdict(dict)
        for entrypoint, req in system_requirements.items():
            if _type in req:
                extracted[entrypoint][_type] = req[_type]
        return cls(dict(extracted))


Instruction:
Explain what the following Python 3 code does
def override_cluster_spec(self, srd):

        merged_cluster_spec = copy.deepcopy(self.entrypoints)

        # Remove entrypoints without "clusterSpec"
        merged_cluster_spec = dict([(k, v) for k, v in merged_cluster_spec.items() if v.get("clusterSpec") is not None])

        # Remove entrypoints not provided in requested instance counts
        merged_cluster_spec = dict([(k, v) for k, v in merged_cluster_spec.items() if \
            k in srd.entrypoints or "*" in srd.entrypoints])

        # Overwrite values of self.entrypoints.clusterSpec with the ones from srd
        # Named entrypoint takes precedence over the wildcard
        for entry_pt, req in merged_cluster_spec.items():
            merged_cluster_spec[entry_pt]["clusterSpec"].update(
                srd.entrypoints.get(entry_pt, srd.entrypoints.get("*"))["clusterSpec"])

        # Check if all entrypoints in srd are included in merged_cluster_spec
        # (if a named entrypoint was used in srd and such an entrypoint doesn't exist
        #  in app sys req, we need to take the cluster spec from the app's "*", if it exists)
        for entry_pt, req in srd.entrypoints.items():
            if entry_pt not in merged_cluster_spec and "*" in self.entrypoints and "clusterSpec" in self.entrypoints["*"]:
                merged_cluster_spec[entry_pt] = {"clusterSpec": copy.deepcopy(self.entrypoints["*"]["clusterSpec"])}
                merged_cluster_spec[entry_pt]["clusterSpec"].update(req["clusterSpec"])

        return SystemRequirementsDict(merged_cluster_spec)

Response: Override the clusterSpec field of the app - xxx run with the new clusterSpec.


Instruction:
Explain what the following Python 3 code does
def _add_dict_values(self, d1, d2):

        if d1 is None and d2 is None:
            return None

        d1 = d1 or {}
        d2 = d2 or {}

        added = {}
        for key in set(list(d1.keys()) + list(d2.keys())):
            added[key] = dict(d1.get(key, {}), **(d2.get(key, {})))
        return added

Response: Adds the values of two dictionaries to the internal dictionary d1 and d2.


Instruction:
Create a Python 3 function for
creating a new remote record object with the specified details.

Response:
def new_dxrecord(details=None, **kwargs):
    '''
    :rtype: :class:`DXRecord`

    :param details: The contents of the record to be created.
    :type details: dict

    Additional optional parameters not listed: all those under
    :func:`dxpy.bindings.DXDataObject.new`, except `details`.

    Creates a new remote record object with project set to *project*
    and returns the appropriate handler.

    Example:

        r = dxpy.new_dxrecord({"x": 1, "y": 2})

    Note that this function is shorthand for::

        dxrecord = DXRecord()
        dxrecord.new(**kwargs)

    '''
    dxrecord = DXRecord()
    dxrecord.new(details=details, **kwargs)
    return dxrecord


Instruction:
How would you code a function in Python 3 to
create a new record object.

Response:
def _new(self, dx_hash, close=False, **kwargs):
        """
        :param dx_hash: Standard hash populated in :func:`dxpy.bindings.DXDataObject.new()` containing attributes common to all data object classes.
        :type dx_hash: dict
        :param init_from: Record from which to initialize the metadata
        :type init_from: :class:`DXRecord`
        :param close: Whether or not to close the record immediately after creating it
        :type close: boolean

        Create a new remote record object.

        """

        if "init_from" in kwargs:
            if kwargs["init_from"] is not None:
                if not isinstance(kwargs["init_from"], DXRecord):
                    raise DXError("Expected instance of DXRecord to init_from")
                dx_hash["initializeFrom"] = \
                    {"id": kwargs["init_from"].get_id(),
                     "project": kwargs["init_from"].get_proj_id()}
            del kwargs["init_from"]

        if close:
            dx_hash["close"] = True

        resp = dxpy.api.record_new(dx_hash, **kwargs)
        self.set_ids(resp["id"], dx_hash["project"])


Instruction:
Explain what the following Python 3 code does
def _recursive_cleanup(foo):
    if isinstance(foo, dict):
        for (key, val) in list(foo.items()):
            if isinstance(val, dict):
                _recursive_cleanup(val)
            if val == "" or val == [] or val == {}:
                del foo[key]

Response: Recursively cleans up things that look empty.


Instruction:
Write a Python 3 script to
dump an executable into a directory that can be used to build a resource container.

Response:
def dump_executable(executable, destination_directory, omit_resources=False, describe_output={}):
    """
    Reconstitutes an app, applet, or a workflow into a directory that would
    create a functionally identical executable if "dx build" were run on it.
    destination_directory will be the root source directory for the
    executable.

    :param executable: executable, i.e. app, applet, or workflow, to be dumped
    :type executable: DXExecutable (either of: DXApp, DXApplet, DXWorkflow, DXGlobalWorkflow)
    :param destination_directory: an existing, empty, and writable directory
    :type destination_directory: str
    :param omit_resources: if True, executable's resources will not be downloaded
    :type omit_resources: boolean
    :param describe_output: output of a describe API call on the executable
    :type describe_output: dictionary
    """
    try:
        old_cwd = os.getcwd()
        os.chdir(destination_directory)
        if isinstance(executable, dxpy.DXWorkflow):
            _dump_workflow(executable, describe_output)
        elif isinstance(executable, dxpy.DXGlobalWorkflow):
            # Add inputs, outputs, stages. These fields contain region-specific values
            # e.g. files or applets, that's why:
            # * if the workflow is global, we will unpack the underlying workflow
            #   from the region of the current project context
            # * if this is a regular, project-based workflow, we will just use
            #   its description (the describe_output that we already have)
            # Underlying workflows are workflows stored in resource containers
            # of the global workflow (one per each region the global workflow is
            # enabled in). #TODO: add a link to documentation.
            current_project = dxpy.WORKSPACE_ID
            if not current_project:
                raise DXError(
                    'A project needs to be selected to "dx get" a global workflow. You can use "dx select" to select a project')
            region = dxpy.api.project_describe(current_project,
                                               input_params={"fields": {"region": True}})["region"]
            describe_output = executable.append_underlying_workflow_desc(describe_output, region)
            _dump_workflow(executable, describe_output)
        else:
            _dump_app_or_applet(executable, omit_resources, describe_output)
    except:
        err_exit()
    finally:
        os.chdir(old_cwd)


Instruction:
Can you generate the documentation for the following Python 3 function
def resolve_data_objects(objects, project=None, folder=None, batchsize=1000):
    if not isinstance(batchsize, int) or batchsize <= 0 or batchsize > 1000:
        raise ValueError("batchsize for resolve_data_objects must be a positive integer not exceeding 1000")
    args = {}
    if project:
        args.update({'project': project})
    if folder:
        args.update({'folder': folder})

    results = []

    # Call API method /system/resolveDataObjects in groups of size batchsize
    for i in range(0, len(objects), batchsize):
        args.update({'objects': objects[i:(i+batchsize)]})
        results.extend(dxpy.api.system_resolve_data_objects(args)['results'])
    return results

Response: Resolves the given list of data objects in a single project folder and folder.


Instruction:
Write a Python 3 function for
returning a generator that yields the objects found in the specified order.

Response:
def _find(api_method, query, limit, return_handler, first_page_size, **kwargs):
    ''' Takes an API method handler (dxpy.api.find*) and calls it with *query*,
    and then wraps a generator around its output. Used by the methods below.

    Note that this function may only be used for /system/find* methods.
    '''
    num_results = 0

    if "limit" not in query:
        query["limit"] = first_page_size

    while True:
        resp = api_method(query, **kwargs)

        by_parent = resp.get('byParent')
        descriptions = resp.get('describe')
        def format_result(result):
            if return_handler:
                result = dxpy.get_handler(result['id'], project=result.get('project'))
            if by_parent is not None:
                return result, by_parent, descriptions
            else:
                return result

        for i in resp["results"]:
            if num_results == limit:
                return
            num_results += 1
            yield format_result(i)

        # set up next query
        if resp["next"] is not None:
            query["starting"] = resp["next"]
            query["limit"] = min(query["limit"]*2, 1000)
        else:
            return


Instruction:
Create a Python 3 function for
searching for data objects in the base object hierarchy.

Response:
def find_data_objects(classname=None, state=None, visibility=None,
                      name=None, name_mode='exact', properties=None,
                      typename=None, tag=None, tags=None,
                      link=None, project=None, folder=None, recurse=None,
                      modified_after=None, modified_before=None,
                      created_after=None, created_before=None,
                      describe=False, limit=None, level=None, region=None,
                      return_handler=False, first_page_size=100,
                      **kwargs):
    """
    :param classname:
        Class with which to restrict the search, i.e. one of "record",
        "file", "applet", "workflow"
    :type classname: string
    :param state: State of the object ("open", "closing", "closed", "any")
    :type state: string
    :param visibility: Visibility of the object ("hidden", "visible", "either")
    :type visibility: string
    :param name: Name of the object (also see *name_mode*)
    :type name: string
    :param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
    :type name_mode: string
    :param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
    :type properties: dict
    :param typename: Type constraint that each result must conform to
    :type typename: string or dict
    :param tag: Tag that each result must be tagged with (deprecated in favor of *tags*)
    :type tag: string
    :param tags: List of tags that each result must have ALL of
    :type tags: list of strings
    :param link: ID of an object that each result must link to
    :type link: string
    :param project: ID of a project in which each result must appear
    :type project: string
    :param folder: If *project* is given, full path to a folder in which each result must belong (default is the root folder)
    :type folder: string
    :param recurse: If *project* is given, whether to look in subfolders of *folder* as well (default is True)
    :type recurse: boolean
    :param modified_after: Timestamp after which each result was last modified (see note below for interpretation)
    :type modified_after: int or string
    :param modified_before: Timestamp before which each result was last modified (see note below for interpretation)
    :type modified_before: int or string
    :param created_after: Timestamp after which each result was last created (see note below for interpretation)
    :type created_after: int or string
    :param created_before: Timestamp before which each result was last created (see note below for interpretation)
    :type created_before: int or string
    :param describe: Controls whether to also return the output of
        calling describe() on each object. Supply False to omit describe
        output, True to obtain the default describe output, or a dict to
        be supplied as the describe call input (which may, among other
        things, be used to customize the set of fields that is returned)
    :type describe: bool or dict
    :param level: The minimum permissions level for which results should be returned (one of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINISTER")
    :param region: Filter on result set by the given region(s).
    :type region: string or list of strings
    :type level: string
    :param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
    :type limit: int
    :param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
    :type first_page_size: int
    :param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
    :type return_handler: boolean
    :rtype: generator

    Returns a generator that yields all data objects matching the query,
    up to *limit* objects. It transparently handles paging through the
    result set if necessary. For all parameters that are omitted, the
    search is not restricted by the corresponding field.

    .. note:: All timestamps must be supplied as one of the following:

       * A nonnegative integer, interpreted as milliseconds since the Epoch
       * A negative integer, interpreted as an offset in milliseconds relative
         to the current time
       * A string containing a negative integer with one of the suffixes
         "s", "m", "d", "w", or "y" (for seconds, minutes, days, weeks,
         or years), interpreted as an offset from the current time.

       The following examples both find all items that were created more
       than 1 week ago::

           items1 = list(find_data_objects(created_before="-1w"))
           items2 = list(find_data_objects(created_before=-7*24*60*60*1000))

    This example iterates through all files with property
    "project" set to "cancer project" and prints their object IDs:

      for result in find_data_objects(classname="file", properties={"project": "cancer project"}):
          print "Found a file with object id " + result["id"]

    """

    query = {}
    if classname is not None:
        query["class"] = classname
    if state is not None:
        query["state"] = state
    if visibility is not None:
        query["visibility"] = visibility
    if name is not None:
        if name_mode == 'exact':
            query["name"] = name
        elif name_mode == 'glob':
            query['name'] = {'glob': name}
        elif name_mode == 'regexp':
            query['name'] = {'regexp': name}
        else:
            raise DXError('find_data_objects: Unexpected value found for argument name_mode')
    if properties is not None:
        query["properties"] = properties
    if typename is not None:
        query["type"] = typename
    if tag is not None and tags is not None:
        raise DXError('find_data_objects: Arguments "tag" and "tags" cannot both be provided')
    if tag is not None:
        query["tag"] = tag
    if tags is not None:
        query["tags"] = {"$and": tags}
    if link is not None:
        query["link"] = link
    if project is not None:
        query["scope"] = {"project": project}
        if folder is not None:
            query["scope"]["folder"] = folder
        if recurse is not None:
            query["scope"]["recurse"] = recurse
    elif folder is not None or recurse is not None:
        if dxpy.WORKSPACE_ID is not None:
            query['scope'] = {'project': dxpy.WORKSPACE_ID}
            if folder is not None:
                query['scope']['folder'] = folder
            if recurse is not None:
                query['scope']['recurse'] = recurse
        else:
            raise DXError("Cannot search within a folder or recurse if a project is not specified")
    if modified_after is not None or modified_before is not None:
        query["modified"] = {}
        if modified_after is not None:
            query["modified"]["after"] = dxpy.utils.normalize_time_input(modified_after)
        if modified_before is not None:
            query["modified"]["before"] = dxpy.utils.normalize_time_input(modified_before)
    if created_after is not None or created_before is not None:
        query["created"] = {}
        if created_after is not None:
            query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
        if created_before is not None:
            query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
    if describe is not None and describe is not False:
        query["describe"] = describe
    if level is not None:
        query['level'] = level
    if region is not None:
        query['region'] = region
    if limit is not None:
        query["limit"] = limit

    return _find(dxpy.api.system_find_data_objects, query, limit, return_handler, first_page_size, **kwargs)


Instruction:
Write a Python 3 script to
search for all executions in the applet or app.

Response:
def find_executions(classname=None, launched_by=None, executable=None, project=None,
                    state=None, origin_job=None, parent_job=None, no_parent_job=False,
                    parent_analysis=None, no_parent_analysis=False, root_execution=None,
                    created_after=None, created_before=None, describe=False,
                    name=None, name_mode="exact", tags=None, properties=None, limit=None,
                    first_page_size=100, return_handler=False, include_subjobs=True,
                    **kwargs):
    '''
    :param classname:
        Class with which to restrict the search, i.e. one of "job",
        "analysis"
    :type classname: string
    :param launched_by: User ID of the user who launched the execution's origin execution
    :type launched_by: string
    :param executable: ID of the applet or app that spawned this execution, or a corresponding remote object handler
    :type executable: string or a DXApp/DXApplet/DXWorkflow instance
    :param project: ID of the project context for the execution
    :type project: string
    :param state: State of the execution (e.g. "failed", "done")
    :type state: string
    :param origin_job: ID of the original job that eventually spawned this execution (possibly by way of other executions)
    :type origin_job: string
    :param parent_job: ID of the parent job (deprecated: use the string 'none' to indicate it should have no parent job; use *no_parent_job* instead)
    :type parent_job: string
    :param no_parent_job: Indicate results should have no parent job; cannot be set to True with *parent_job* set to a string
    :type no_parent_job: boolean
    :param parent_analysis: ID of the parent analysis (deprecated: use the string 'none' to indicate it should have no parent analysis; use *no_parent_analysis* instead)
    :type parent_analysis: string
    :param no_parent_analysis: Indicate results should have no parent analysis; cannot be set to True with *parent_analysis* set to a string
    :type no_parent_job: boolean
    :param root_execution: ID of the top-level (user-initiated) execution (job or analysis) that eventually spawned this execution (possibly by way of other executions)
    :type root_execution: string
    :param created_after: Timestamp after which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
    :type created_after: int or string
    :param created_before: Timestamp before which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
    :type created_before: int or string
    :param describe: Controls whether to also return the output of
        calling describe() on each execution. Supply False to omit
        describe output, True to obtain the default describe output, or
        a dict to be supplied as the describe call input (which may be
        used to customize the set of fields that is to be returned; for
        example, you can supply {"io": False} to suppress detailed
        information about the execution's inputs and outputs)
    :type describe: bool or dict
    :param name: Name of the job or analysis to search by (also see *name_mode*)
    :type name: string
    :param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
    :type name_mode: string
    :param tags: List of tags that each result must have ALL of
    :type tags: list of strings
    :param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
    :type properties: dict
    :param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
    :type limit: int
    :param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
    :type first_page_size: int
    :param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
    :type return_handler: boolean
    :param include_subjobs: If False, no subjobs will be returned by the API
    :type include_subjobs: boolean
    :rtype: generator

    Returns a generator that yields all executions (jobs or analyses) that match the query. It transparently handles
    paging through the result set if necessary. For all parameters that are omitted, the search is not restricted by
    the corresponding field.

    The following example iterates through all finished jobs and analyses in a
    particular project that were launched in the last two days::

      for result in find_executions(state="done", project=proj_id, created_after="-2d"):
          print "Found job or analysis with object id " + result["id"]

    '''

    query = {}
    if classname is not None:
        query["class"] = classname
    if launched_by is not None:
        query["launchedBy"] = launched_by
    if executable is not None:
        if isinstance(executable, (DXApplet, DXApp, DXWorkflow)):
            query["executable"] = executable.get_id()
        else:
            query["executable"] = executable
    if project is not None:
        if isinstance(project, DXProject):
            query["project"] = project.get_id()
        else:
            query["project"] = project
    if state is not None:
        query["state"] = state
    if origin_job is not None:
        if isinstance(origin_job, DXJob):
            query["originJob"] = origin_job.get_id()
        else:
            query["originJob"] = origin_job
    if parent_job is not None:
        if no_parent_job:
            raise DXError('find_executions: Cannot provide parent_job and set no_parent_job to True')
        if parent_job == "none": # to be deprecated
            query["parentJob"] = None
        elif isinstance(parent_job, DXJob):
            query["parentJob"] = parent_job.get_id()
        else:
            query["parentJob"] = parent_job
    elif no_parent_job:
        query["parentJob"] = None
    if parent_analysis is not None:
        if no_parent_analysis:
            raise DXError('find_executions: Cannot provide parent_analysis and set no_parent_analysis to True')
        if parent_analysis == "none": # to be deprecated
            query["parentAnalysis"] = None
        elif isinstance(parent_analysis, DXAnalysis):
            query["parentAnalysis"] = parent_analysis.get_id()
        else:
            query["parentAnalysis"] = parent_analysis
    elif no_parent_analysis:
        query["parentAnalysis"] = None
    if root_execution is not None:
        if isinstance(root_execution, (DXJob, DXAnalysis)):
            query["rootExecution"] = root_execution.get_id()
        else:
            query["rootExecution"] = root_execution
    if created_after is not None or created_before is not None:
        query["created"] = {}
        if created_after is not None:
            query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
        if created_before is not None:
            query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
    if describe is not None and describe is not False:
        query["describe"] = describe
    if name is not None:
        if name_mode == 'exact':
            query['name'] = name
        elif name_mode == 'glob':
            query['name'] = {'glob': name}
        elif name_mode == 'regexp':
            query['name'] = {'regexp': name}
        else:
            raise DXError('find_executions: Unexpected value found for argument name_mode')
    if tags is not None:
        query['tags'] = {'$and': tags}
    if properties is not None:
        query['properties'] = properties
    if include_subjobs is not True:
        query["includeSubjobs"] = include_subjobs
    if limit is not None:
        query["limit"] = limit

    return _find(dxpy.api.system_find_executions, query, limit, return_handler, first_page_size, **kwargs)


Instruction:
Here you have a function in Python 3, explain what it does
def find_projects(name=None, name_mode='exact', properties=None, tags=None,
                  level=None, describe=False, explicit_perms=None, region=None,
                  public=None, created_after=None, created_before=None, billed_to=None,
                  limit=None, return_handler=False, first_page_size=100, containsPHI=None, **kwargs):
    """
    :param name: Name of the project (also see *name_mode*)
    :type name: string
    :param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
    :type name_mode: string
    :param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
    :type properties: dict
    :param tags: Tags that each result must have
    :type tags: list of strings
    :param level: One of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINSTER". If specified, only returns projects where the current user has at least the specified permission level.
    :type level: string
    :param describe: Controls whether to also return the output of
        calling describe() on each project. Supply False to omit
        describe output, True to obtain the default describe output, or
        a dict to be supplied as the describe call input (which may be
        used to customize the set of fields that is returned)
    :type describe: bool or dict
    :param explicit_perms: Filter on presence of an explicit permision. If True, matching projects must have an explicit permission (any permission granted directly to the user or an organization to which the user belongs). If False, matching projects must not have any explicit permissions for the user. (default is None, for no filter)
    :type explicit_perms: boolean or None
    :param region: If specified, only returns projects where the project is in the given region.
    :type region: string
    :param public: Filter on the project being public. If True, matching projects must be public. If False, matching projects must not be public. (default is None, for no filter)
    :type public: boolean or None
    :param created_after: Timestamp after which each result was created
        (see note accompanying :meth:`find_data_objects()` for interpretation)
    :type created_after: int or string
    :param created_before: Timestamp before which each result was created
        (see note accompanying :meth:`find_data_objects()` for interpretation)
    :type created_before: int or string
    :param billed_to: Entity ID (user or organization) that pays for the project's storage costs
    :type billed_to: string
    :param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
    :type limit: int
    :param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
    :type first_page_size: int
    :param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
    :type return_handler: boolean
    :param containsPHI: If set to true, only returns projects that contain PHI.
        If set to false, only returns projects that do not contain PHI.
    :type containsPHI: boolean
    :rtype: generator

    Returns a generator that yields all projects that match the query.
    It transparently handles paging through the result set if necessary.
    For all parameters that are omitted, the search is not restricted by
    the corresponding field.

    You can use the *level* parameter to find projects that the user has
    at least a specific level of access to (e.g. "CONTRIBUTE").

    """
    query = {}
    if name is not None:
        if name_mode == 'exact':
            query['name'] = name
        elif name_mode == 'glob':
            query['name'] = {'glob': name}
        elif name_mode == 'regexp':
            query['name'] = {'regexp': name}
        else:
            raise DXError('find_projects: Unexpected value found for argument name_mode')
    if properties is not None:
        query["properties"] = properties
    if tags is not None:
        query["tags"] = {"$and": tags}
    if level is not None:
        query["level"] = level
    if describe is not None and describe is not False:
        query["describe"] = describe
    if explicit_perms is not None:
        query['explicitPermission'] = explicit_perms
    if public is not None:
        query['public'] = public
    if created_after is not None or created_before is not None:
        query["created"] = {}
        if created_after is not None:
            query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
        if created_before is not None:
            query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
    if region is not None:
        query['region'] = region
    if billed_to is not None:
        query['billTo'] = billed_to
    if limit is not None:
        query["limit"] = limit
    if containsPHI is not None:
        query["containsPHI"] = containsPHI

    return _find(dxpy.api.system_find_projects, query, limit, return_handler, first_page_size, **kwargs)

Response: Find projects in a resource tree.


Instruction:
Make a summary of the following Python 3 code
def find_apps(name=None, name_mode='exact', category=None,
              all_versions=None, published=None,
              billed_to=None, created_by=None, developer=None,
              created_after=None, created_before=None,
              modified_after=None, modified_before=None,
              describe=False, limit=None, return_handler=False, first_page_size=100, **kwargs):
    """
    This method is identical to :meth:`find_global_executables()` with the API method
    used: :meth:`system_find_apps()`.
    """
    return find_global_executables(dxpy.api.system_find_apps,
                                   name=name, name_mode=name_mode, category=category,
                                   all_versions=all_versions, published=published,
                                   billed_to=billed_to, created_by=created_by, developer=developer,
                                   created_after=created_after, created_before=created_before,
                                   modified_after=modified_after, modified_before=modified_before,
                                   describe=describe, limit=limit, return_handler=return_handler,
                                   first_page_size=first_page_size, **kwargs)

Response: Find all apps in a node.


Instruction:
How would you implement a function in Python 3 that
returns a single data object that satisfies the supplied constraints.

Response:
def find_one_data_object(zero_ok=False, more_ok=True, **kwargs):
    """
    :param zero_ok:
        If False (default), :class:`~dxpy.exceptions.DXSearchError` is
        raised if the search has 0 results; if True, returns None if the
        search has 0 results
    :type zero_ok: bool
    :param more_ok:
        If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
        the search has 2 or more results
    :type more_ok: bool

    Returns one data object that satisfies the supplied constraints, or
    None if none exist (provided *zero_ok* is True). Supports all search
    constraint arguments supported by :meth:`find_data_objects()`.

    """
    return _find_one(find_data_objects, zero_ok=zero_ok, more_ok=more_ok, **kwargs)


Instruction:
Can you tell what is the following Python 3 function doing
def find_one_project(zero_ok=False, more_ok=True, **kwargs):
    return _find_one(find_projects, zero_ok=zero_ok, more_ok=more_ok, **kwargs)

Response: Returns a single project that satisfies the supplied constraints.


Instruction:
Given the following Python 3 function, write the documentation
def find_one_app(zero_ok=False, more_ok=True, **kwargs):
    return _find_one(find_apps, zero_ok=zero_ok, more_ok=more_ok, **kwargs)

Response: Returns a single app that satisfies the supplied constraints.


Instruction:
Write a Python 3 function for
returning a generator that yields the objects from the API method with org_id and query.

Response:
def _org_find(api_method, org_id, query, first_page_size=100):
    """
    Takes an API method handler ``dxpy.api.org_find...`` and calls it with
    *org_id* and *query*, then wraps a generator around its output. Used by
    :meth:`org_find_members` and :meth:`org_find_projects` below.

    :param first_page_size: The number of results that the initial API call will return.
    :type first_page_size: int

    """
    if "limit" not in query:
        query["limit"] = min(first_page_size, 1000)

    while True:
        resp = api_method(org_id, query)
        for result in resp["results"]:
            yield result

        # set up next query
        if resp["next"] is not None:
            query["starting"] = resp["next"]
            query["limit"] = min(query["limit"] * 2, 1000)
        else:
            break


Instruction:
Here you have a function in Python 3, explain what it does
def org_find_members(org_id=None, level=None, describe=False):
    query = {}
    if level is not None:
        query["level"] = level
    query["describe"] = describe

    return _org_find(dxpy.api.org_find_members, org_id, query)

Response: Returns a generator that yields all org members that match the specified criteria.


Instruction:
Can you tell what is the following Python 3 function doing
def org_find_projects(org_id=None, name=None, name_mode='exact', ids=None, properties=None, tags=None, describe=False,
                      public=None, created_after=None, created_before=None, region=None, containsPHI=None):
    """
    :param org_id: ID of the organization
    :type org_id: string
    :param name: Name that each result must have (also see *name_mode* param)
    :type name: string
    :param name_mode: Method by which to interpret the *name* param ("exact": exact match,
        "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
    :type name_mode: string
    :param ids: List of project IDs. Each result must have a project ID that was specified in this list.
    :type ids: array of strings
    :param properties: Properties (key-value pairs) that each result must have
        (use value True to require the property key and allow any value)
    :type properties: dict
    :param tags: Tags that each result must have
    :type tags: list of strings
    :param describe: Whether or not to return the response of ``dxpy.api.project_describe`` for each result. False
        omits the describe response; True includes it; a dict will be used as the input to
        ``dxpy.api.project_describe`` (to customize the desired set of fields in the describe response).
    :type describe: bool or dict
    :param public: True indicates that each result must be public; False indicates that each result must be private;
        None indicates that both public and private projects will be returned in the result set.
    :type public: boolean or None
    :param created_after: Timestamp after which each result was created
        (see note accompanying :meth:`find_data_objects()` for interpretation)
    :type created_after: int or string
    :param created_before: Timestamp before which each result was created
        (see note accompanying :meth:`find_data_objects()` for interpretation)
    :type created_before: int or string
    :param region: If specified, only returns projects where the project is in the given region.
    :type region: string
    :param containsPHI: If set to true, only returns projects that contain PHI.
        If set to false, only returns projects that do not contain PHI.
    :type containsPHI: boolean
    :rtype: generator

    Returns a generator that yields all projects that match the query formed by intersecting all specified
    constraints. The search is not restricted by any parameters that were unspecified.

    """
    query = {}
    if name is not None:
        if name_mode == 'exact':
            query['name'] = name
        elif name_mode == 'glob':
            query['name'] = {'glob': name}
        elif name_mode == 'regexp':
            query['name'] = {'regexp': name}
        else:
            raise DXError('org_find_projects: Unexpected value found for argument name_mode')
    if ids is not None:
        query["id"] = ids
    if properties is not None:
        if len(properties.keys()) == 1:
            query["properties"] = properties
        else:
            query["properties"] = {"$and": [{k: v} for (k, v) in properties.iteritems()]}
    if tags is not None:
        if len(tags) == 1:
            query["tags"] = tags[0]
        else:
            query["tags"] = {"$and": tags}
    query["describe"] = describe
    if public is not None:
        query['public'] = public
    if created_after is not None or created_before is not None:
        query["created"] = {}
        if created_after is not None:
            query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
        if created_before is not None:
            query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
    if region is not None:
        query['region'] = region
    if containsPHI is not None:
        query["containsPHI"] = containsPHI

    return _org_find(dxpy.api.org_find_projects, org_id, query)

Response: Find all projects in the organization.